mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
Cleanup failsafe beeper code and update failsafe unit tests.
This commit is contained in:
parent
519586a5ce
commit
7266d42466
4 changed files with 31 additions and 22 deletions
|
@ -140,10 +140,13 @@ void failsafeUpdateState(void)
|
|||
{
|
||||
bool receivingRxData = failsafeIsReceivingRxData();
|
||||
bool armed = ARMING_FLAG(ARMED);
|
||||
beeperMode_e beeperMode = BEEPER_STOPPED;
|
||||
|
||||
if (receivingRxData) {
|
||||
failsafeState.phase = FAILSAFE_IDLE;
|
||||
failsafeState.active = false;
|
||||
} else {
|
||||
beeperMode = BEEPER_RX_LOST;
|
||||
}
|
||||
|
||||
|
||||
|
@ -162,7 +165,6 @@ void failsafeUpdateState(void)
|
|||
break;
|
||||
|
||||
case FAILSAFE_RX_LOSS_DETECTED:
|
||||
beeper(BEEPER_TX_LOST_ARMED);
|
||||
|
||||
if (failsafeShouldForceLanding(armed)) {
|
||||
// Stabilize, and set Throttle to specified level
|
||||
|
@ -175,6 +177,7 @@ void failsafeUpdateState(void)
|
|||
case FAILSAFE_LANDING:
|
||||
if (armed) {
|
||||
failsafeApplyControlInput();
|
||||
beeperMode = BEEPER_RX_LOST_LANDING;
|
||||
}
|
||||
|
||||
if (failsafeShouldHaveCausedLandingByNow() || !armed) {
|
||||
|
@ -188,8 +191,6 @@ void failsafeUpdateState(void)
|
|||
|
||||
case FAILSAFE_LANDED:
|
||||
|
||||
beeper(BEEPER_TX_LOST);
|
||||
|
||||
if (!armed) {
|
||||
break;
|
||||
}
|
||||
|
@ -206,6 +207,10 @@ void failsafeUpdateState(void)
|
|||
break;
|
||||
}
|
||||
} while (reprocessState);
|
||||
|
||||
if (beeperMode != BEEPER_STOPPED) {
|
||||
beeper(beeperMode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue