mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-21 13:02:25 +08:00
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:
@@ -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
|
||||
|
||||
@@ -179,6 +179,10 @@ private:
|
||||
bool _last_state_battery_warning_critical{false};
|
||||
const int _caller_id_battery_warning_emergency{genCallerId()};
|
||||
bool _last_state_battery_warning_emergency{false};
|
||||
const int _caller_id_fd_esc_arming{genCallerId()};
|
||||
bool _last_state_fd_esc_arming{false};
|
||||
const int _caller_id_battery_unhealthy_spoolup{genCallerId()};
|
||||
bool _last_state_battery_unhealthy_spoolup{false};
|
||||
|
||||
hrt_abstime _armed_time{0};
|
||||
bool _was_armed{false};
|
||||
|
||||
Reference in New Issue
Block a user