DataFlash: immediately restart logging after erasing logs

This commit is contained in:
Peter Barker 2016-09-18 22:31:29 +10:00 committed by Randy Mackay
parent f94f7e2aa0
commit 8f376944aa
1 changed files with 5 additions and 0 deletions

View File

@ -451,6 +451,7 @@ char *DataFlash_File::_lastlog_file_name(void) const
void DataFlash_File::EraseAll()
{
uint16_t log_num;
const bool was_logging = (_write_fd != -1);
stop_logging();
#if !DATAFLASH_FILE_MINIMAL
for (log_num=1; log_num<=MAX_LOG_FILES; log_num++) {
@ -468,6 +469,10 @@ void DataFlash_File::EraseAll()
}
#endif
_cached_oldest_log = 0;
if (was_logging) {
start_new_log();
}
}
/* Write a block of data at current offset */