From 469b5f98e2085613e2ee7c1eb87353c7644039e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Sat, 9 Jun 2018 11:42:34 +0200 Subject: [PATCH] commander Preflight::preflightCheck: transition condition_system_sensors_initialized only to true - this matches the logic in arming_state_transition() - if Commander::preflight_check was run in armed state and the checks failed, disarming was not possible anymore (because disarming checks for condition_system_sensors_initialized). That is currently not the case, but the existing logic is way too fragile. Alternative solution: check if armed in Preflight::preflightCheck, and only transition to false if disarmed (but also respect the re-arming grace period). --- src/modules/commander/commander.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 34dd9e65d5..0c9e608dd7 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -4057,7 +4057,9 @@ bool Commander::preflight_check(bool report) bool success = Preflight::preflightCheck(&mavlink_log_pub, status, status_flags, checkGNSS, report, false, hrt_elapsed_time(&commander_boot_timestamp)); - status_flags.condition_system_sensors_initialized = success; + if (success) { + status_flags.condition_system_sensors_initialized = true; + } return success; }