From f8e1708ebf00438bce2abdace9ea2f4dbb3aea31 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Thu, 23 Mar 2023 19:44:50 +0100 Subject: [PATCH] failsafe: COM_LOW_BAT_ACT also configures time based low battery action --- src/modules/commander/failsafe/failsafe.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/commander/failsafe/failsafe.cpp b/src/modules/commander/failsafe/failsafe.cpp index 2f79e92cff..af45256e0f 100644 --- a/src/modules/commander/failsafe/failsafe.cpp +++ b/src/modules/commander/failsafe/failsafe.cpp @@ -404,7 +404,9 @@ void Failsafe::checkStateAndMode(const hrt_abstime &time_us, const State &state, CHECK_FAILSAFE(status_flags, primary_geofence_breached, fromGfActParam(_param_gf_action.get()).cannotBeDeferred()); // Battery - CHECK_FAILSAFE(status_flags, battery_low_remaining_time, ActionOptions(Action::RTL).causedBy(Cause::BatteryLow)); + ActionOptions battery_low_remaining_time_action = (_param_com_low_bat_act.get() == LowBatteryAction::ReturnOrLand) ? + ActionOptions(Action::RTL).causedBy(Cause::BatteryLow) : Action::Warn; + CHECK_FAILSAFE(status_flags, battery_low_remaining_time, battery_low_remaining_time_action); CHECK_FAILSAFE(status_flags, battery_unhealthy, Action::Warn); switch (status_flags.battery_warning) {