Copter: added AUX switch option for enable/disable EKF

This commit is contained in:
Andrew Tridgell 2014-01-04 12:39:08 +11:00
parent 38ac8d404a
commit a112694a50
2 changed files with 10 additions and 0 deletions

View File

@ -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
}
}

View File

@ -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)