From 92bf761bf1dc26b168f9b0258787fe3e3521d8c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Mon, 24 Sep 2018 12:04:24 +0200 Subject: [PATCH] PreflightCheck: do not check for primary mag & inconsistencies if system has no mag --- src/modules/commander/PreflightCheck.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/modules/commander/PreflightCheck.cpp b/src/modules/commander/PreflightCheck.cpp index 26fdc8d5a1d..fe904a499f5 100644 --- a/src/modules/commander/PreflightCheck.cpp +++ b/src/modules/commander/PreflightCheck.cpp @@ -717,19 +717,21 @@ bool preflightCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s &status, } } - /* check if the primary device is present */ - if (!prime_found) { - if (reportFailures && !failed) { - mavlink_log_critical(mavlink_log_pub, "Primary compass not found"); + if (sys_has_mag == 1) { + /* check if the primary device is present */ + if (!prime_found) { + if (reportFailures && !failed) { + mavlink_log_critical(mavlink_log_pub, "Primary compass not found"); + } + + set_health_flags(subsystem_info_s::SUBSYSTEM_TYPE_MAG, false, true, false, status); + failed = true; } - set_health_flags(subsystem_info_s::SUBSYSTEM_TYPE_MAG, false, true, false, status); - failed = true; - } - - /* mag consistency checks (need to be performed after the individual checks) */ - if (!magConsistencyCheck(mavlink_log_pub, status, (reportFailures && !failed))) { - failed = true; + /* mag consistency checks (need to be performed after the individual checks) */ + if (!magConsistencyCheck(mavlink_log_pub, status, (reportFailures && !failed))) { + failed = true; + } } }