diff --git a/ArduCopter/control_modes.pde b/ArduCopter/control_modes.pde index 718bf26f63..3abcbbfa60 100644 --- a/ArduCopter/control_modes.pde +++ b/ArduCopter/control_modes.pde @@ -98,6 +98,7 @@ static void init_aux_switches() case AUX_SWITCH_RESETTOARMEDYAW: case AUX_SWITCH_SUPERSIMPLE_MODE: case AUX_SWITCH_ACRO_TRAINER: + case AUX_SWITCH_SPRAYER: do_aux_switch_function(g.ch7_option, ap_system.CH7_flag); break; } @@ -109,6 +110,7 @@ static void init_aux_switches() case AUX_SWITCH_RESETTOARMEDYAW: case AUX_SWITCH_SUPERSIMPLE_MODE: case AUX_SWITCH_ACRO_TRAINER: + case AUX_SWITCH_SPRAYER: do_aux_switch_function(g.ch8_option, ap_system.CH8_flag); break; } @@ -260,6 +262,12 @@ static void do_aux_switch_function(int8_t ch_function, uint8_t ch_flag) g.acro_trainer = ACRO_TRAINER_LIMITED; break; } + +#if SPRAYER == ENABLED + case AUX_SWITCH_SPRAYER: + sprayer.enable(ch_flag == AUX_SWITCH_HIGH); + break; +#endif } } diff --git a/ArduCopter/defines.h b/ArduCopter/defines.h index 276dde24cc..2531bef954 100644 --- a/ArduCopter/defines.h +++ b/ArduCopter/defines.h @@ -66,6 +66,7 @@ #define AUX_SWITCH_RESETTOARMEDYAW 12 // changes yaw to be same as when quad was armed #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 // 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)