diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index 8e82458315..0260cc4ebd 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -2190,7 +2190,9 @@ Commander::run() _cpuload_sub.update(&_cpuload); - battery_status_check(); + if (_battery_status_subs.updated()) { + battery_status_check(); + } /* If in INIT state, try to proceed to STANDBY state */ if (!_status_flags.condition_calibration_enabled && _status.arming_state == vehicle_status_s::ARMING_STATE_INIT) { @@ -3604,13 +3606,6 @@ void Commander::avoidance_check() void Commander::battery_status_check() { - // We need to update the status flag if ANY battery is updated, because the system source might have - // changed, or might be nothing (if there is no battery connected) - if (!_battery_status_subs.updated()) { - // Nothing has changed since the last time this function was called, so nothing needs to be done now. - return; - } - battery_status_s batteries[_battery_status_subs.size()]; size_t num_connected_batteries = 0;