diff --git a/ArduCopter/control_modes.pde b/ArduCopter/control_modes.pde index 93ca383c09..6d9f8b33e7 100644 --- a/ArduCopter/control_modes.pde +++ b/ArduCopter/control_modes.pde @@ -109,6 +109,7 @@ static void init_aux_switches() case AUX_SWITCH_ACRO_TRAINER: case AUX_SWITCH_EPM: case AUX_SWITCH_SPRAYER: + case AUX_SWITCH_EKF: do_aux_switch_function(g.ch7_option, ap.CH7_flag); break; } @@ -122,6 +123,7 @@ static void init_aux_switches() case AUX_SWITCH_ACRO_TRAINER: case AUX_SWITCH_EPM: case AUX_SWITCH_SPRAYER: + case AUX_SWITCH_EKF: do_aux_switch_function(g.ch8_option, ap.CH8_flag); break; } @@ -371,6 +373,13 @@ static void do_aux_switch_function(int8_t ch_function, uint8_t ch_flag) } } break; + +#if AP_AHRS_NAVEKF_AVAILABLE + case AUX_SWITCH_EKF: + ahrs.set_ekf_use(ch_flag==AUX_SWITCH_HIGH); + break; +#endif + } } diff --git a/ArduCopter/defines.h b/ArduCopter/defines.h index b7dcb0e3a5..97a7e42230 100644 --- a/ArduCopter/defines.h +++ b/ArduCopter/defines.h @@ -52,6 +52,7 @@ #define AUX_SWITCH_AUTOTUNE 17 // auto tune #define AUX_SWITCH_LAND 18 // change to LAND flight mode #define AUX_SWITCH_EPM 19 // Operate the EPM cargo gripper low=off, middle=neutral, high=on +#define AUX_SWITCH_EKF 20 // Enable NavEKF // values used by the ap.ch7_opt and ap.ch8_opt flags #define AUX_SWITCH_LOW 0 // indicates auxiliar switch is in the low position (pwm <1200)