diff --git a/ArduCopter/control_modes.pde b/ArduCopter/control_modes.pde index 3abcbbfa60..6cc3f4d4b8 100644 --- a/ArduCopter/control_modes.pde +++ b/ArduCopter/control_modes.pde @@ -268,6 +268,17 @@ static void do_aux_switch_function(int8_t ch_function, uint8_t ch_flag) sprayer.enable(ch_flag == AUX_SWITCH_HIGH); break; #endif + + case AUX_SWITCH_AUTO_AND_LAND: + switch(ch_flag) { + case AUX_SWITCH_LOW: + case AUX_SWITCH_MIDDLE: + set_mode(LAND); + break; + case AUX_SWITCH_HIGH: + set_mode(AUTO); + break; + } } } diff --git a/ArduCopter/defines.h b/ArduCopter/defines.h index 2531bef954..5204d5d659 100644 --- a/ArduCopter/defines.h +++ b/ArduCopter/defines.h @@ -67,6 +67,7 @@ #define AUX_SWITCH_SUPERSIMPLE_MODE 13 // change to simple mode in middle, super simple at top #define AUX_SWITCH_ACRO_TRAINER 14 // low = disabled, middle = leveled, high = leveled and limited #define AUX_SWITCH_SPRAYER 15 // enable/disable the crop sprayer +#define AUX_SWITCH_AUTO_AND_LAND 16 // switch enabled auto (high) or land (low) flight modes // 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)