From 7ceafcb469decc082b3b9498571a427aeefa7946 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 9 Jun 2017 13:38:28 +1000 Subject: [PATCH] Rover: simplify should_log (NFC) --- APMrover2/system.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/APMrover2/system.cpp b/APMrover2/system.cpp index e36ab20db6..ca5638ff9a 100644 --- a/APMrover2/system.cpp +++ b/APMrover2/system.cpp @@ -546,14 +546,22 @@ uint8_t Rover::check_digital_pin(uint8_t pin) */ bool Rover::should_log(uint32_t mask) { - if (!(mask & g.log_bitmask) || in_mavlink_delay) { + if (in_mavlink_delay) { return false; } - const bool ret = hal.util->get_soft_armed() || DataFlash.log_while_disarmed(); - if (ret && !DataFlash.logging_started() && !in_log_download) { + if (!(mask & g.log_bitmask)) { + return false; + } + if (!hal.util->get_soft_armed() && !DataFlash.log_while_disarmed()) { + return false; + } + if (in_log_download) { + return false; + } + if (!DataFlash.logging_started()) { start_logging(); } - return ret; + return true; } /*