Skip to content

Commit

Permalink
wip3
Browse files Browse the repository at this point in the history
  • Loading branch information
Hwurzburg committed Oct 18, 2024
1 parent 3765cf6 commit 0e2abb2
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions libraries/AP_Mount/AP_Mount_CADDX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ void AP_Mount_CADDX::send_target_angles(const MountTarget& angle_target_rad)

//todo: add mode here
cmd_set_angles_data.mode = GIMBAL_MODE_TILT_ROLL_LOCK;
cmd_set_angles_data.mode = mount_lock_mode;

// CRC here
uint16_t crc16 = 0;
Expand Down
4 changes: 4 additions & 0 deletions libraries/AP_Mount/AP_Mount_CADDX.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class AP_Mount_CADDX : public AP_Mount_Backend_Serial

// has_pitch_control - returns true if this mount can control its tilt
bool has_pitch_control() const override { return pitch_range_valid(); };

void set_mount_mode(const uint8_t mount_lock_mode);

uint8_t mount_lock_mode;


protected:
Expand Down
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:
// nothing
break;
case AuxSwitchPos::MIDDLE:
// nothing
break;
case AuxSwitchPos::HIGH:
//nothing
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 0e2abb2

Please sign in to comment.