RC_Channel: Add soaring aux function.

This commit is contained in:
Samuel Tabor 2020-07-13 09:45:57 +01:00 committed by Andrew Tridgell
parent d8f2d0cf8d
commit 455ebaadf2
3 changed files with 28 additions and 0 deletions

View File

@ -96,6 +96,27 @@ void RC_Channel_Plane::do_aux_function_crow_mode(AuxSwitchPos ch_flag)
}
}
void RC_Channel_Plane::do_aux_function_soaring_3pos(AuxSwitchPos ch_flag)
{
#if SOARING_ENABLED == ENABLED
SoaringController::ActiveStatus desired_state = SoaringController::ActiveStatus::SOARING_DISABLED;
switch (ch_flag) {
case AuxSwitchPos::LOW:
desired_state = SoaringController::ActiveStatus::SOARING_DISABLED;
break;
case AuxSwitchPos::MIDDLE:
desired_state = SoaringController::ActiveStatus::MANUAL_MODE_CHANGE;
break;
case AuxSwitchPos::HIGH:
desired_state = SoaringController::ActiveStatus::AUTO_MODE_CHANGE;
break;
}
plane.g2.soaring_controller.set_pilot_desired_state(desired_state);
#endif
}
void RC_Channel_Plane::init_aux_function(const RC_Channel::aux_func_t ch_option,
const RC_Channel::AuxSwitchPos ch_flag)
{
@ -184,6 +205,10 @@ void RC_Channel_Plane::do_aux_function(const aux_func_t ch_option, const AuxSwit
do_aux_function_change_mode(Mode::Number::TAKEOFF, ch_flag);
break;
case AUX_FUNC::SOARING:
do_aux_function_soaring_3pos(ch_flag);
break;
case AUX_FUNC::FLAP:
break; // flap input label, nothing to do

View File

@ -21,6 +21,8 @@ private:
void do_aux_function_q_assist_state(AuxSwitchPos ch_flag);
void do_aux_function_crow_mode(AuxSwitchPos ch_flag);
void do_aux_function_soaring_3pos(AuxSwitchPos ch_flag);
};
class RC_Channels_Plane : public RC_Channels

View File

@ -185,6 +185,7 @@ public:
GENERATOR = 85, // generator control
TER_DISABLE = 86, // disable terrain following in CRUISE/FBWB modes
CROW_SELECT = 87, // select CROW mode for diff spoilers;high disables,mid forces progressive
SOARING = 88, // three-position switch to set soaring mode
// entries from 100 onwards are expected to be developer
// options used for testing