Skip to content

Commit

Permalink
RC_Channel: add KILL_MAG auxiliary functions
Browse files Browse the repository at this point in the history
  • Loading branch information
bugobliterator committed Jul 3, 2024
1 parent 6c91b76 commit f4ff438
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions libraries/RC_Channel/RC_Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,11 @@ void RC_Channel::init_aux_function(const AUX_FUNC ch_option, const AuxSwitchPos
case AUX_FUNC::KILL_IMU1:
case AUX_FUNC::KILL_IMU2:
case AUX_FUNC::KILL_IMU3:
#endif
#if AP_COMPASS_KILL_MAG_ENABLED
case AUX_FUNC::KILL_MAG1:
case AUX_FUNC::KILL_MAG2:
case AUX_FUNC::KILL_MAG3:
#endif
case AUX_FUNC::MISSION_RESET:
case AUX_FUNC::MOTOR_ESTOP:
Expand Down Expand Up @@ -1524,6 +1529,20 @@ bool RC_Channel::do_aux_function(const AUX_FUNC ch_option, const AuxSwitchPos ch
break;
#endif // AP_INERTIALSENSOR_KILL_IMU_ENABLED

#if AP_COMPASS_KILL_MAG_ENABLED
case AUX_FUNC::KILL_MAG1:
AP::compass().kill_mag(0, ch_flag == AuxSwitchPos::HIGH);
break;

case AUX_FUNC::KILL_MAG2:
AP::compass().kill_mag(1, ch_flag == AuxSwitchPos::HIGH);
break;

case AUX_FUNC::KILL_MAG3:
AP::compass().kill_mag(2, ch_flag == AuxSwitchPos::HIGH);
break;
#endif // AP_COMPASS_KILL_MAG_ENABLED

#if AP_CAMERA_ENABLED
case AUX_FUNC::CAMERA_TRIGGER:
do_aux_function_camera_trigger(ch_flag);
Expand Down
3 changes: 3 additions & 0 deletions libraries/RC_Channel/RC_Channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ class RC_Channel {
KILL_IMU3 = 110, // disable third IMU (for IMU failure testing)
LOWEHEISER_STARTER = 111, // allows for manually running starter
AHRS_TYPE = 112, // change AHRS_EKF_TYPE
KILL_MAG1 = 113, // disable first magnetometer (for magnetometer failure testing)
KILL_MAG2 = 114, // disable second magnetometer (for magnetometer failure testing)
KILL_MAG3 = 115, // disable third magnetometer (for magnetometer failure testing)

// if you add something here, make sure to update the documentation of the parameter in RC_Channel.cpp!
// also, if you add an option >255, you will need to fix duplicate_options_exist
Expand Down

0 comments on commit f4ff438

Please sign in to comment.