From 2521e78a7fdcb50d7b9762fd112283354f9fb089 Mon Sep 17 00:00:00 2001 From: Claudio Chies <61051109+Claudio-Chies@users.noreply.github.com> Date: Wed, 23 Sep 2026 17:39:03 +0200 Subject: [PATCH] fix(commander): allow RC calibration in SIH mode (#28821) --- src/modules/commander/Commander.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index 3cb6e65982c..383634605cf 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -1436,12 +1436,15 @@ Commander::handle_command(const vehicle_command_s &cmd) // reject if armed or shutting down answer_command(cmd, vehicle_command_ack_s::VEHICLE_CMD_RESULT_TEMPORARILY_REJECTED); - } else if (_vehicle_status.hil_state == vehicle_status_s::HIL_STATE_ON) { - // reject calibration in SIH mode — simulated sensors cannot be calibrated + } else if (_vehicle_status.hil_state == vehicle_status_s::HIL_STATE_ON + && ((int)(cmd.param1) != 0 || (int)(cmd.param2) != 0 || (int)(cmd.param3) != 0 + || (int)(cmd.param5) != 0 || (int)(cmd.param6) != 0 || (int)(cmd.param7) != 0)) { + // reject sensor calibration in SIH mode — simulated sensors cannot be calibrated, + // RC (param4) is a real receiver and stays allowed answer_command(cmd, vehicle_command_ack_s::VEHICLE_CMD_RESULT_DENIED); - mavlink_log_critical(&_mavlink_log_pub, "Calibration denied: not supported in SIH mode\t"); + mavlink_log_critical(&_mavlink_log_pub, "Sensor calibration denied: not supported in SIH mode\t"); events::send(events::ID("commander_calib_denied_sih"), events::Log::Critical, - "Calibration denied: not supported in SIH mode"); + "Sensor calibration denied: not supported in SIH mode"); } else {