1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 17:25:20 +03:00

Refactored 'WAS_EVER_ARMED' arming flag to be only enabled on first disarm.

This commit is contained in:
mikeller 2019-11-30 15:01:55 +13:00
parent 938f46ccd1
commit 93c708f57d
4 changed files with 6 additions and 6 deletions

View file

@ -425,6 +425,7 @@ void updateArmingStatus(void)
void disarm(void) void disarm(void)
{ {
if (ARMING_FLAG(ARMED)) { if (ARMING_FLAG(ARMED)) {
ENABLE_ARMING_FLAG(WAS_EVER_ARMED);
DISABLE_ARMING_FLAG(ARMED); DISABLE_ARMING_FLAG(ARMED);
lastDisarmTimeUs = micros(); lastDisarmTimeUs = micros();
@ -519,7 +520,6 @@ void tryArm(void)
osdSuppressStats(false); osdSuppressStats(false);
#endif #endif
ENABLE_ARMING_FLAG(ARMED); ENABLE_ARMING_FLAG(ARMED);
ENABLE_ARMING_FLAG(WAS_EVER_ARMED);
resetTryingToArm(); resetTryingToArm();

View file

@ -209,7 +209,7 @@ void failsafeUpdateState(void)
} }
// Beep RX lost only if we are not seeing data and we have been armed earlier // Beep RX lost only if we are not seeing data and we have been armed earlier
if (!receivingRxData && ARMING_FLAG(WAS_EVER_ARMED)) { if (!receivingRxData && (armed || ARMING_FLAG(WAS_EVER_ARMED))) {
beeperMode = BEEPER_RX_LOST; beeperMode = BEEPER_RX_LOST;
} }

View file

@ -816,18 +816,18 @@ static void osdRefreshStats(void)
static timeDelta_t osdShowArmed(void) static timeDelta_t osdShowArmed(void)
{ {
static bool everArmed = false;
timeDelta_t ret; timeDelta_t ret;
displayClearScreen(osdDisplayPort); displayClearScreen(osdDisplayPort);
if ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_ON) || ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_FIRST) && !everArmed)) {
if ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_ON) || ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_FIRST) && !ARMING_FLAG(WAS_EVER_ARMED))) {
osdDrawLogo(3, 1); osdDrawLogo(3, 1);
ret = osdConfig()->logo_on_arming_duration * 1e5; ret = osdConfig()->logo_on_arming_duration * 1e5;
} else { } else {
ret = (REFRESH_1S / 2); ret = (REFRESH_1S / 2);
} }
displayWrite(osdDisplayPort, 12, 7, DISPLAYPORT_ATTR_NONE, "ARMED"); displayWrite(osdDisplayPort, 12, 7, DISPLAYPORT_ATTR_NONE, "ARMED");
everArmed = true;
return ret; return ret;
} }

View file

@ -1445,7 +1445,7 @@ static void osdElementWarnings(osdElementParms_t *element)
#endif // USE_RC_SMOOTHING_FILTER #endif // USE_RC_SMOOTHING_FILTER
// Show warning if battery is not fresh // Show warning if battery is not fresh
if (osdWarnGetState(OSD_WARNING_BATTERY_NOT_FULL) && !ARMING_FLAG(WAS_EVER_ARMED) && (getBatteryState() == BATTERY_OK) if (osdWarnGetState(OSD_WARNING_BATTERY_NOT_FULL) && !(ARMING_FLAG(ARMED) || ARMING_FLAG(WAS_EVER_ARMED)) && (getBatteryState() == BATTERY_OK)
&& getBatteryAverageCellVoltage() < batteryConfig()->vbatfullcellvoltage) { && getBatteryAverageCellVoltage() < batteryConfig()->vbatfullcellvoltage) {
tfp_sprintf(element->buff, "BATT < FULL"); tfp_sprintf(element->buff, "BATT < FULL");
element->attr = DISPLAYPORT_ATTR_INFO; element->attr = DISPLAYPORT_ATTR_INFO;