From a378f2b8fa7e95d3f6bbabaadd4fcaae719449db Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 20 Apr 2019 11:26:05 +1000 Subject: [PATCH] AP_Logger: force logging on an armed watchdog reset and don't clear sdcard space --- libraries/DataFlash/DataFlash.cpp | 4 ++++ libraries/DataFlash/DataFlash_File.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/libraries/DataFlash/DataFlash.cpp b/libraries/DataFlash/DataFlash.cpp index 0ae3c5e839..c4941fc40a 100644 --- a/libraries/DataFlash/DataFlash.cpp +++ b/libraries/DataFlash/DataFlash.cpp @@ -84,6 +84,10 @@ DataFlash_Class::DataFlash_Class(const AP_Int32 &log_bitmask) void DataFlash_Class::Init(const struct LogStructure *structures, uint8_t num_types) { gcs().send_text(MAV_SEVERITY_INFO, "Preparing log system"); + if (hal.util->was_watchdog_armed()) { + gcs().send_text(MAV_SEVERITY_INFO, "Forcing logging for watchdog reset"); + _params.log_disarmed.set(1); + } #if CONFIG_HAL_BOARD == HAL_BOARD_SITL validate_structures(structures, num_types); dump_structures(structures, num_types); diff --git a/libraries/DataFlash/DataFlash_File.cpp b/libraries/DataFlash/DataFlash_File.cpp index 907f02e13c..39aee4b29c 100644 --- a/libraries/DataFlash/DataFlash_File.cpp +++ b/libraries/DataFlash/DataFlash_File.cpp @@ -342,6 +342,10 @@ uint16_t DataFlash_File::find_oldest_log() void DataFlash_File::Prep_MinSpace() { + if (hal.util->was_watchdog_reset()) { + // don't clear space if watchdog reset, it takes too long + return; + } const uint16_t first_log_to_remove = find_oldest_log(); if (first_log_to_remove == 0) { // no files to remove