From a3e3eb8d1cc9394a18d33a88080fac628747264a Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Wed, 26 Nov 2014 18:35:21 +0100 Subject: [PATCH] [rotorcraft] allow to turn off motors in failsafe mode Allow arming/disarming motor as long as not in KILL mode and ahrs is aligned. --- sw/airborne/firmwares/rotorcraft/autopilot.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sw/airborne/firmwares/rotorcraft/autopilot.c b/sw/airborne/firmwares/rotorcraft/autopilot.c index 5924ab731d..6e51fbd71e 100644 --- a/sw/airborne/firmwares/rotorcraft/autopilot.c +++ b/sw/airborne/firmwares/rotorcraft/autopilot.c @@ -512,7 +512,15 @@ void autopilot_on_rc_frame(void) { autopilot_set_mode(new_autopilot_mode); } - /* if not in FAILSAFE or HOME mode check motor and in_flight status, read RC */ + /* an arming sequence is used to start/stop motors. + * only allow switching motor if not in KILL mode and ahrs is aligned + */ + if (autopilot_mode != AP_MODE_KILL && ahrs_is_aligned()) { + autopilot_arming_check_motors_on(); + kill_throttle = ! autopilot_motors_on; + } + + /* if not in FAILSAFE or HOME mode, read RC and set commands accordingly */ if (autopilot_mode != AP_MODE_FAILSAFE && autopilot_mode != AP_MODE_HOME) { /* if there are some commands that should always be set from RC, do it */ @@ -527,15 +535,6 @@ void autopilot_on_rc_frame(void) { } #endif - /* an arming sequence is used to start/stop motors. - * only allow switching motor if not in FAILSAFE or KILL mode and ahrs is aligned - */ - if (autopilot_mode != AP_MODE_KILL && autopilot_mode != AP_MODE_FAILSAFE && - ahrs_is_aligned()) { - autopilot_arming_check_motors_on(); - kill_throttle = ! autopilot_motors_on; - } - guidance_v_read_rc(); guidance_h_read_rc(autopilot_in_flight); }