Skip to content

Commit

Permalink
RC_Channel: add CADDX gimbal mount
Browse files Browse the repository at this point in the history
  • Loading branch information
Hwurzburg committed Oct 19, 2024
1 parent f46ac20 commit aa763c0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions libraries/RC_Channel/RC_Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ const AP_Param::GroupInfo RC_Channel::var_info[] = {
// @Values{Copter}: 178:FlightMode Pause/Resume
// @Values{Plane}: 179:ICEngine start / stop
// @Values{Copter, Plane}: 180:Test autotuned gains after tune is complete
// @Values{Copter,Plane,Rover,Blimp}: 181:Mount Mode
// @Values{Rover}: 201:Roll
// @Values{Rover}: 202:Pitch
// @Values{Rover}: 207:MainSail
Expand Down Expand Up @@ -756,6 +757,7 @@ void RC_Channel::init_aux_function(const AUX_FUNC ch_option, const AuxSwitchPos
case AUX_FUNC::RETRACT_MOUNT1:
case AUX_FUNC::RETRACT_MOUNT2:
case AUX_FUNC::MOUNT_LOCK:
case AUX_FUNC::MOUNT_MODE:
#endif
#if HAL_LOGGING_ENABLED
case AUX_FUNC::LOG_PAUSE:
Expand Down Expand Up @@ -891,6 +893,7 @@ const RC_Channel::LookupTable RC_Channel::lookuptable[] = {
#endif
#if HAL_MOUNT_ENABLED
{ AUX_FUNC::MOUNT_LRF_ENABLE, "Mount LRF Enable"},
{ AUX_FUNC::MOUNT_MODE, "Mount Mode"},
#endif
};

Expand Down Expand Up @@ -1748,6 +1751,25 @@ bool RC_Channel::do_aux_function(const AUX_FUNC ch_option, const AuxSwitchPos ch
mount->set_rangefinder_enable(0, ch_flag == AuxSwitchPos::HIGH);
break;
}

case AUX_FUNC::MOUNT_MODE:{
AP_Mount *mount = AP::mount();
if (mount == nullptr) {
break;
}
switch (ch_flag) {
case AuxSwitchPos::LOW:
mount->set_mount_mode(0);
break;
case AuxSwitchPos::MIDDLE:
// mount->set_mount_mode(1);
break;
case AuxSwitchPos::HIGH:
// mount->set_mount_mode(2);
break;
}
break;
}
#endif

#if HAL_LOGGING_ENABLED
Expand Down
1 change: 1 addition & 0 deletions libraries/RC_Channel/RC_Channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ class RC_Channel {
FLIGHTMODE_PAUSE = 178, // e.g. pause movement towards waypoint
ICE_START_STOP = 179, // AP_ICEngine start stop
AUTOTUNE_TEST_GAINS = 180, // auto tune tuning switch to test or revert gains
MOUNT_MODE = 181, //mount operating mode


// inputs from 200 will eventually used to replace RCMAP
Expand Down

0 comments on commit aa763c0

Please sign in to comment.