From a7577067975241e65b7dbdc8627e7ac5ceda57e7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 1 Jul 2021 13:40:16 +1000 Subject: [PATCH] AP_Logger: fixed log creation on forced arm when we force arm we need to ask the IO thread to create the log, not create it ourselves --- libraries/AP_Logger/AP_Logger_File.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libraries/AP_Logger/AP_Logger_File.cpp b/libraries/AP_Logger/AP_Logger_File.cpp index b1ebdb9cb8..989a0c96af 100644 --- a/libraries/AP_Logger/AP_Logger_File.cpp +++ b/libraries/AP_Logger/AP_Logger_File.cpp @@ -134,14 +134,19 @@ void AP_Logger_File::periodic_1Hz() } if (_initialised && + !start_new_log_pending && _write_fd == -1 && _read_fd == -1 && logging_enabled() && - !recent_open_error() && - !hal.util->get_soft_armed()) { + !recent_open_error()) { // retry logging open. This allows for booting with // LOG_DISARMED=1 with a bad microSD or no microSD. Once a // card is inserted then logging starts - start_new_log(); + // this also allows for logging to start after forced arming + if (!hal.util->get_soft_armed()) { + start_new_log(); + } else { + start_new_log_pending = true; + } } if (!io_thread_alive()) {