RC_Channel: add mount LRF enable aux function

This commit is contained in:
Randy Mackay 2024-03-15 09:58:43 +09:00
parent b7e4aecc99
commit 4b9a4cad65
2 changed files with 13 additions and 0 deletions

View File

@ -236,6 +236,7 @@ const AP_Param::GroupInfo RC_Channel::var_info[] = {
// @Values{Copter, Rover, Plane, Blimp}: 174:Camera Image Tracking
// @Values{Copter, Rover, Plane, Blimp}: 175:Camera Lens
// @Values{Plane}: 176:Quadplane Fwd Throttle Override enable
// @Values{Copter, Rover, Plane, Blimp}: 177:Mount LRF enable
// @Values{Rover}: 201:Roll
// @Values{Rover}: 202:Pitch
// @Values{Rover}: 207:MainSail
@ -665,6 +666,7 @@ void RC_Channel::init_aux_function(const aux_func_t ch_option, const AuxSwitchPo
case AUX_FUNC::LOWEHEISER_STARTER:
case AUX_FUNC::MAG_CAL:
case AUX_FUNC::CAMERA_IMAGE_TRACKING:
case AUX_FUNC::MOUNT_LRF_ENABLE:
break;
// not really aux functions:
@ -771,6 +773,7 @@ const RC_Channel::LookupTable RC_Channel::lookuptable[] = {
{ AUX_FUNC::CAMERA_AUTO_FOCUS, "Camera Auto Focus"},
{ AUX_FUNC::CAMERA_IMAGE_TRACKING, "Camera Image Tracking"},
{ AUX_FUNC::CAMERA_LENS, "Camera Lens"},
{ AUX_FUNC::MOUNT_LRF_ENABLE, "Mount LRF Enable"},
};
/* lookup the announcement for switch change */
@ -1555,6 +1558,15 @@ bool RC_Channel::do_aux_function(const aux_func_t ch_option, const AuxSwitchPos
mount->set_yaw_lock(ch_flag == AuxSwitchPos::HIGH);
break;
}
case AUX_FUNC::MOUNT_LRF_ENABLE: {
AP_Mount *mount = AP::mount();
if (mount == nullptr) {
break;
}
mount->set_rangefinder_enable(0, ch_flag == AuxSwitchPos::HIGH);
break;
}
#endif
#if HAL_LOGGING_ENABLED

View File

@ -249,6 +249,7 @@ public:
CAMERA_IMAGE_TRACKING = 174, // camera image tracking
CAMERA_LENS = 175, // camera lens selection
VFWD_THR_OVERRIDE = 176, // force enabled VTOL forward throttle method
MOUNT_LRF_ENABLE = 177, // mount LRF enable/disable
// inputs from 200 will eventually used to replace RCMAP