From c0e01e8d2b11a762b242f5d80d5a1ac0f5ea2f54 Mon Sep 17 00:00:00 2001 From: Zap Andersson Date: Sat, 19 Mar 2016 16:16:49 +0100 Subject: [PATCH] Add 'WAS_EVER_ARMED' arming flag --- src/main/config/runtime_config.h | 3 ++- src/main/flight/failsafe.c | 4 ++-- src/main/mw.c | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/config/runtime_config.h b/src/main/config/runtime_config.h index 6b4dee82e5..9bb81fe11f 100644 --- a/src/main/config/runtime_config.h +++ b/src/main/config/runtime_config.h @@ -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; diff --git a/src/main/flight/failsafe.c b/src/main/flight/failsafe.c index 66a0a6cc39..86384212ed 100644 --- a/src/main/flight/failsafe.c +++ b/src/main/flight/failsafe.c @@ -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; } diff --git a/src/main/mw.c b/src/main/mw.c index d8e2f30820..f4e823b035 100644 --- a/src/main/mw.c +++ b/src/main/mw.c @@ -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