fixed #1532 - wrong warnings and stroboscope effect from ledstrip / beeper when fc not armed
This commit is contained in:
TheAngularity 2016-11-12 18:07:59 +01:00 committed by GitHub
parent 7942765ada
commit 9be78a15e2
1 changed files with 2 additions and 2 deletions

View File

@ -92,7 +92,7 @@ void updateBattery(void)
uint16_t vbatMeasured = batteryAdcToVoltage(vbatLatestADC);
/* battery has just been connected*/
if (batteryState == BATTERY_NOT_PRESENT && (ARMING_FLAG(ARMED) || (vbat > batteryConfig->batterynotpresentlevel && ABS(vbatMeasured - batteryAdcToVoltage(vbatPreviousADC)) <= VBAT_STABLE_MAX_DELTA))) {
if (batteryState == BATTERY_NOT_PRESENT && vbat > batteryConfig->batterynotpresentlevel && ABS(vbatMeasured - batteryAdcToVoltage(vbatPreviousADC)) <= VBAT_STABLE_MAX_DELTA) {
/* Actual battery state is calculated below, this is really BATTERY_PRESENT */
batteryState = BATTERY_OK;
@ -105,7 +105,7 @@ void updateBattery(void)
batteryWarningVoltage = batteryCellCount * batteryConfig->vbatwarningcellvoltage;
batteryCriticalVoltage = batteryCellCount * batteryConfig->vbatmincellvoltage;
/* battery has been disconnected - can take a while for filter cap to disharge so we use a threshold of batteryConfig->batterynotpresentlevel */
} else if (batteryState != BATTERY_NOT_PRESENT && (!ARMING_FLAG(ARMED) || (vbat <= batteryConfig->batterynotpresentlevel && ABS(vbatMeasured - batteryAdcToVoltage(vbatPreviousADC)) <= VBAT_STABLE_MAX_DELTA))) {
} else if (batteryState != BATTERY_NOT_PRESENT && !ARMING_FLAG(ARMED) && vbat <= batteryConfig->batterynotpresentlevel && ABS(vbatMeasured - batteryAdcToVoltage(vbatPreviousADC)) <= VBAT_STABLE_MAX_DELTA) {
batteryState = BATTERY_NOT_PRESENT;
batteryCellCount = 0;
batteryWarningVoltage = 0;