fix commander: separate state tracking for battery_unhealthy failsafe (#24493)

There is already another check for battery_unhealthy, so a separate state
and ID are required.

Fixes the error:
ERROR [failsafe] BUG: duplicate check for caller_id 74
This commit is contained in:
Beat Küng authored and GitHub committed 2025-03-12 16:46:02 +01:00
1 parent b5e2395982
commit a3c387fa85
2 files changed
+10 -2

No files matched your search

+6 -2
View File
@@ -577,8 +577,12 @@ void Failsafe::checkStateAndMode(const hrt_abstime &time_us, const State &state,
if ((_armed_time != 0)
&& (time_us < _armed_time + static_cast<hrt_abstime>(_param_com_spoolup_time.get() * 1_s))
) {
CHECK_FAILSAFE(status_flags, fd_esc_arming_failure, ActionOptions(Action::Disarm).cannotBeDeferred());
CHECK_FAILSAFE(status_flags, battery_unhealthy, ActionOptions(Action::Disarm).cannotBeDeferred());
_last_state_fd_esc_arming = checkFailsafe(_caller_id_fd_esc_arming, _last_state_fd_esc_arming,
status_flags.fd_esc_arming_failure,
ActionOptions(Action::Disarm).cannotBeDeferred());
_last_state_battery_unhealthy_spoolup = checkFailsafe(_caller_id_battery_unhealthy_spoolup,
_last_state_battery_unhealthy_spoolup, status_flags.battery_unhealthy,
ActionOptions(Action::Disarm).cannotBeDeferred());
}
// Handle fails during the early takeoff phase