From 9be78a15e2d8af722b4d1c08fc4496a651ad3431 Mon Sep 17 00:00:00 2001 From: TheAngularity Date: Sat, 12 Nov 2016 18:07:59 +0100 Subject: [PATCH] fixed #1532 fixed #1532 - wrong warnings and stroboscope effect from ledstrip / beeper when fc not armed --- src/main/sensors/battery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/sensors/battery.c b/src/main/sensors/battery.c index 10d5482e8..89a5e6f9a 100644 --- a/src/main/sensors/battery.c +++ b/src/main/sensors/battery.c @@ -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;