Rover: add LOITER to ch7 options

This commit is contained in:
Ammarf 2018-05-24 17:13:12 +09:00 committed by Randy Mackay
parent 85efab1ec8
commit b95ac72d35
3 changed files with 13 additions and 3 deletions

View File

@ -41,7 +41,7 @@ const AP_Param::Info Rover::var_info[] = {
// @Param: INITIAL_MODE
// @DisplayName: Initial driving mode
// @Description: This selects the mode to start in on boot. This is useful for when you want to start in AUTO mode on boot without a receiver. Usually used in combination with when AUTO_TRIGGER_PIN or AUTO_KICKSTART.
// @Values: 0:MANUAL,1:ACRO,3:STEERING,4:HOLD,10:AUTO,11:RTL,15:GUIDED
// @Values: 0:MANUAL,1:ACRO,3:STEERING,4:HOLD,5:LOITER,10:AUTO,11:RTL,15:GUIDED
// @User: Advanced
GSCALAR(initial_mode, "INITIAL_MODE", MANUAL),
@ -129,7 +129,7 @@ const AP_Param::Info Rover::var_info[] = {
// @Param: CH7_OPTION
// @DisplayName: Channel 7 option
// @Description: What to do use channel 7 for
// @Values: 0:Nothing,1:SaveWaypoint,2:LearnCruiseSpeed,3:ArmDisarm,4:Manual,5:Acro,6:Steering,7:Hold,8:Auto,9:RTL,10:SmartRTL,11:Guided
// @Values: 0:Nothing,1:SaveWaypoint,2:LearnCruiseSpeed,3:ArmDisarm,4:Manual,5:Acro,6:Steering,7:Hold,8:Auto,9:RTL,10:SmartRTL,11:Guided,12:Loiter
// @User: Standard
GSCALAR(ch7_option, "CH7_OPTION", CH7_OPTION),

View File

@ -273,6 +273,15 @@ void Rover::read_aux_switch()
reset_control_switch();
}
break;
// Set mode to LOITER
case CH7_LOITER:
if (aux_ch7 == AUX_SWITCH_HIGH) {
set_mode(mode_loiter, MODE_REASON_TX_COMMAND);
} else if ((aux_ch7 == AUX_SWITCH_LOW) && (control_mode == &mode_loiter)) {
reset_control_switch();
}
break;
}
}

View File

@ -26,7 +26,8 @@ enum ch7_option {
CH7_AUTO = 8,
CH7_RTL = 9,
CH7_SMART_RTL = 10,
CH7_GUIDED = 11
CH7_GUIDED = 11,
CH7_LOITER = 12
};
// HIL enumerations