Add 'WAS_EVER_ARMED' arming flag

This commit is contained in:
Zap Andersson 2016-03-19 16:16:49 +01:00
parent ca0fb6c9cf
commit c0e01e8d2b
3 changed files with 5 additions and 3 deletions

View File

@ -21,7 +21,8 @@
typedef enum {
OK_TO_ARM = (1 << 0),
PREVENT_ARMING = (1 << 1),
ARMED = (1 << 2)
ARMED = (1 << 2),
WAS_EVER_ARMED = (1 << 3)
} armingFlag_e;
extern uint8_t armingFlags;

View File

@ -172,8 +172,8 @@ void failsafeUpdateState(void)
bool failsafeSwitchIsOn = IS_RC_MODE_ACTIVE(BOXFAILSAFE);
beeperMode_e beeperMode = BEEPER_SILENCE;
// Beep RX lost only if we are not seeing data, but we have seen it in the past.
if (!receivingRxData && failsafeState.validRxDataReceivedAt) {
// Beep RX lost only if we are not seeing data and we have been armed earlier
if (!receivingRxData && ARMING_FLAG(WAS_EVER_ARMED)) {
beeperMode = BEEPER_RX_LOST;
}

View File

@ -366,6 +366,7 @@ void mwArm(void)
}
if (!ARMING_FLAG(PREVENT_ARMING)) {
ENABLE_ARMING_FLAG(ARMED);
ENABLE_ARMING_FLAG(WAS_EVER_ARMED);
headFreeModeHold = DECIDEGREES_TO_DEGREES(attitude.values.yaw);
#ifdef BLACKBOX