Copter: Sprayer enable added to CH7/CH8 switch

This commit is contained in:
Randy Mackay 2013-08-04 23:38:38 +09:00
parent c7464f635c
commit e1fe4946fb
2 changed files with 9 additions and 0 deletions

View File

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

View File

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