[rotorcraft] arming: only check if motors can be armed if ahrs_is_aligned

This commit is contained in:
Felix Ruess
2014-11-24 21:14:50 +01:00
parent 63ba5a17a3
commit 78b52b6f3c
3 changed files with 10 additions and 13 deletions
+8 -3
View File
@@ -527,9 +527,14 @@ void autopilot_on_rc_frame(void) {
} }
#endif #endif
/* an arming sequence is used to start/stop motors */ /* an arming sequence is used to start/stop motors.
autopilot_arming_check_motors_on(); * only allow switching motor if not in FAILSAFE or KILL mode and ahrs is aligned
kill_throttle = ! autopilot_motors_on; */
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_v_read_rc();
guidance_h_read_rc(autopilot_in_flight); guidance_h_read_rc(autopilot_in_flight);
@@ -69,14 +69,10 @@ static inline void autopilot_arming_set(bool_t motors_on) {
* - if throttle was not down at startup, you need to put throttle down again first * - if throttle was not down at startup, you need to put throttle down again first
* - other sticks need to be centered to start motors * - other sticks need to be centered to start motors
* - need to be in manual mode to start the motors * - need to be in manual mode to start the motors
* - AHRS needs to be aligned
*/ */
static inline void autopilot_arming_check_motors_on( void ) { static inline void autopilot_arming_check_motors_on( void ) {
/* only allow switching motor if not in FAILSAFE or KILL mode */ switch(autopilot_arming_state) {
if (autopilot_mode != AP_MODE_KILL && autopilot_mode != AP_MODE_FAILSAFE) {
switch(autopilot_arming_state) {
case STATE_UNINIT: case STATE_UNINIT:
autopilot_motors_on = FALSE; autopilot_motors_on = FALSE;
autopilot_arming_delay_counter = 0; autopilot_arming_delay_counter = 0;
@@ -140,7 +136,6 @@ static inline void autopilot_arming_check_motors_on( void ) {
break; break;
default: default:
break; break;
}
} }
} }
@@ -75,10 +75,8 @@ static inline void autopilot_arming_set(bool_t motors_on) {
* The stick must return to a neutral position before starting/stoping again. * The stick must return to a neutral position before starting/stoping again.
*/ */
static inline void autopilot_arming_check_motors_on( void ) { static inline void autopilot_arming_check_motors_on( void ) {
/* only allow switching motor if not in FAILSAFE or KILL mode */
if (autopilot_mode != AP_MODE_KILL && autopilot_mode != AP_MODE_FAILSAFE) {
switch(autopilot_check_motor_status) { switch(autopilot_check_motor_status) {
case STATUS_MOTORS_OFF: case STATUS_MOTORS_OFF:
autopilot_motors_on = FALSE; autopilot_motors_on = FALSE;
autopilot_motors_on_counter = 0; autopilot_motors_on_counter = 0;
@@ -121,7 +119,6 @@ static inline void autopilot_arming_check_motors_on( void ) {
break; break;
default: default:
break; break;
};
} }
} }