AP_Logger: force logging on an armed watchdog reset

and don't clear sdcard space
This commit is contained in:
Andrew Tridgell 2019-04-20 11:26:05 +10:00 committed by Randy Mackay
parent f217f504e5
commit a378f2b8fa
2 changed files with 8 additions and 0 deletions

View File

@ -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) void DataFlash_Class::Init(const struct LogStructure *structures, uint8_t num_types)
{ {
gcs().send_text(MAV_SEVERITY_INFO, "Preparing log system"); 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 #if CONFIG_HAL_BOARD == HAL_BOARD_SITL
validate_structures(structures, num_types); validate_structures(structures, num_types);
dump_structures(structures, num_types); dump_structures(structures, num_types);

View File

@ -342,6 +342,10 @@ uint16_t DataFlash_File::find_oldest_log()
void DataFlash_File::Prep_MinSpace() 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(); const uint16_t first_log_to_remove = find_oldest_log();
if (first_log_to_remove == 0) { if (first_log_to_remove == 0) {
// no files to remove // no files to remove