Copter: RC_Channel: add weathervane enable/disable switch

This commit is contained in:
Iampete1 2022-09-01 15:06:45 +01:00 committed by Bill Geyer
parent 01481b2ec4
commit 3fedd0d8b2

View File

@ -121,6 +121,7 @@ void RC_Channel_Copter::init_aux_function(const aux_func_t ch_option, const AuxS
case AUX_FUNC::AIRMODE:
case AUX_FUNC::FORCEFLYING:
case AUX_FUNC::CUSTOM_CONTROLLER:
case AUX_FUNC::WEATHER_VANE_ENABLE:
run_aux_function(ch_option, ch_flag, AuxFuncTriggerSource::INIT);
break;
default:
@ -618,6 +619,22 @@ bool RC_Channel_Copter::do_aux_function(const aux_func_t ch_option, const AuxSwi
break;
#endif
#if WEATHERVANE_ENABLED == ENABLED
case AUX_FUNC::WEATHER_VANE_ENABLE: {
switch (ch_flag) {
case AuxSwitchPos::HIGH:
copter.g2.weathervane.allow_weathervaning(true);
break;
case AuxSwitchPos::MIDDLE:
break;
case AuxSwitchPos::LOW:
copter.g2.weathervane.allow_weathervaning(false);
break;
}
break;
}
#endif
default:
return RC_Channel::do_aux_function(ch_option, ch_flag);
}