From 68e9cbf23dea16049bea381e0bf68a9ebf9a9ca5 Mon Sep 17 00:00:00 2001 From: mahima-yoga Date: Tue, 22 Sep 2026 16:20:30 +0200 Subject: [PATCH] fix(commander): don't report "compass uncalibrated" while calibrating --- .../HealthAndArmingChecks/checks/magnetometerCheck.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/modules/commander/HealthAndArmingChecks/checks/magnetometerCheck.cpp b/src/modules/commander/HealthAndArmingChecks/checks/magnetometerCheck.cpp index b690fbad74c..5975461540b 100644 --- a/src/modules/commander/HealthAndArmingChecks/checks/magnetometerCheck.cpp +++ b/src/modules/commander/HealthAndArmingChecks/checks/magnetometerCheck.cpp @@ -46,6 +46,9 @@ void MagnetometerChecks::checkAndReport(const Context &context, Report &reporter bool had_failure = false; int num_enabled_and_valid_calibration = 0; + // Skip the calibration-state reports while the mags are being calibrated + const bool calibration_in_progress = context.status().calibration_enabled; + for (int instance = 0; instance < _sensor_mag_sub.size(); instance++) { const bool exists = _sensor_mag_sub[instance].advertised(); bool is_valid = false; @@ -106,7 +109,7 @@ void MagnetometerChecks::checkAndReport(const Context &context, Report &reporter mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: No valid data from Compass %u", instance); } - } else if (!is_calibration_valid) { + } else if (!is_calibration_valid && !calibration_in_progress) { /* EVENT */ reporter.armingCheckFailure(NavModes::All, health_component_t::magnetometer, @@ -117,7 +120,7 @@ void MagnetometerChecks::checkAndReport(const Context &context, Report &reporter mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: Compass %u uncalibrated", instance); } - } else if (is_mag_fault) { + } else if (is_mag_fault && !calibration_in_progress) { /* EVENT * @description * Recalibrate the compass and check the orientation. @@ -134,7 +137,7 @@ void MagnetometerChecks::checkAndReport(const Context &context, Report &reporter } } - if (!had_failure && !context.isArmed()) { + if (!had_failure && !context.isArmed() && !calibration_in_progress) { consistencyCheck(context, reporter); if (num_enabled_and_valid_calibration < _param_sys_has_mag.get()) {