failsafe: prevent immediate low battery failsafe for existing low battery state

This happens when BAT_CRIT_THR allows arming with a critical battery level. With this change it still fails the checks but only warns instead of doing the failsafe action because that would immediately land the vehicle before it has taken off.
This commit is contained in:
Matthias Grob
2024-10-08 18:49:23 +02:00
parent 7941310afd
commit 4a08ebafbc
2 changed files with 10 additions and 3 deletions
@@ -173,6 +173,7 @@ private:
hrt_abstime _armed_time{0};
bool _was_armed{false};
bool _manual_control_lost_at_arming{false}; ///< true if manual control was lost at arming time
uint8_t _battery_warning_at_arming{0}; ///< low battery state at arming time
DEFINE_PARAMETERS_CUSTOM_PARENT(FailsafeBase,
(ParamInt<px4::params::NAV_DLL_ACT>) _param_nav_dll_act,