From 9489857f01be337b791ef84ee88cb74e139740b3 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Sun, 1 Sep 2013 17:00:43 +0200 Subject: [PATCH] [rotorcraft] add FAILSAFE_ON_BAT_CRITICAL set FAILSAFE_ON_BAT_CRITICAL to TRUE if you want to go into FAILSAFE mode (neutral attitude, slowly descend) if battery status is critical (vsupply voltage below CRITIC_BAT_LEVEL for a while) --- sw/airborne/firmwares/rotorcraft/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sw/airborne/firmwares/rotorcraft/main.c b/sw/airborne/firmwares/rotorcraft/main.c index beb36fcb31..8dfd160743 100644 --- a/sw/airborne/firmwares/rotorcraft/main.c +++ b/sw/airborne/firmwares/rotorcraft/main.c @@ -222,6 +222,14 @@ STATIC_INLINE void failsafe_check( void ) { autopilot_set_mode(AP_MODE_FAILSAFE); } +#if FAILSAFE_ON_BAT_CRITICAL + if (autopilot_mode != AP_MODE_KILL && + electrical.bat_critical) + { + autopilot_set_mode(AP_MODE_FAILSAFE); + } +#endif + #if USE_GPS if (autopilot_mode == AP_MODE_NAV && autopilot_motors_on &&