diff --git a/libraries/RC_Channel/RC_Channel.cpp b/libraries/RC_Channel/RC_Channel.cpp index f3cecf7e4a4ae9..98e1d907a3136b 100644 --- a/libraries/RC_Channel/RC_Channel.cpp +++ b/libraries/RC_Channel/RC_Channel.cpp @@ -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: @@ -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); diff --git a/libraries/RC_Channel/RC_Channel.h b/libraries/RC_Channel/RC_Channel.h index 2d8d1ab850a2ba..4012850811a55a 100644 --- a/libraries/RC_Channel/RC_Channel.h +++ b/libraries/RC_Channel/RC_Channel.h @@ -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