diff --git a/src/modules/commander/HealthAndArmingChecks/checks/magnetometerCheck.cpp b/src/modules/commander/HealthAndArmingChecks/checks/magnetometerCheck.cpp index 117a23a2b8..6716a8e06a 100644 --- a/src/modules/commander/HealthAndArmingChecks/checks/magnetometerCheck.cpp +++ b/src/modules/commander/HealthAndArmingChecks/checks/magnetometerCheck.cpp @@ -50,10 +50,6 @@ void MagnetometerChecks::checkAndReport(const Context &context, Report &reporter bool is_mag_fault = false; const bool is_required = instance == 0 || isMagRequired(instance, is_mag_fault); - if (!is_required) { - continue; - } - const bool exists = _sensor_mag_sub[instance].advertised(); bool is_valid = false; bool is_calibration_valid = false; @@ -83,6 +79,11 @@ void MagnetometerChecks::checkAndReport(const Context &context, Report &reporter reporter.setIsPresent(health_component_t::magnetometer); } + // Do not raise errors if a mag is not required + if (!is_required) { + continue; + } + const bool is_sensor_ok = is_valid && is_calibration_valid && !is_mag_fault; if (!is_sensor_ok) {