Copter: add ch7/ch8 Auto and Land option

CH7/CH8 high initiates AUTO mode, low initiates Land.  Ideally high
would be a new take-off flight mode so this may need some rework.
This commit is contained in:
Randy Mackay 2013-08-15 16:08:33 +09:00
parent ac620e2140
commit 69da4e99f8
2 changed files with 12 additions and 0 deletions

View File

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

View File

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