From cfd6d95927ee5540fd5fa6036004abbb56cc91d1 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 9 Jun 2017 13:14:13 +1000 Subject: [PATCH] Copter: simplify should_log (NFC) --- ArduCopter/system.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ArduCopter/system.cpp b/ArduCopter/system.cpp index acc2edc332..783abae991 100644 --- a/ArduCopter/system.cpp +++ b/ArduCopter/system.cpp @@ -492,14 +492,22 @@ void Copter::check_usb_mux(void) bool Copter::should_log(uint32_t mask) { #if LOGGING_ENABLED == ENABLED - if (!(mask & g.log_bitmask) || in_mavlink_delay) { + if (in_mavlink_delay) { return false; } - bool ret = motors->armed() || DataFlash.log_while_disarmed(); - if (ret && !DataFlash.logging_started() && !in_log_download) { + if (!(mask & g.log_bitmask)) { + return false; + } + if (!motors->armed() && !DataFlash.log_while_disarmed()) { + return false; + } + if (in_log_download) { + return false; + } + if (!DataFlash.logging_started()) { start_logging(); } - return ret; + return true; #else return false; #endif