DataFlash: stop logging when erasing logs

This commit is contained in:
Andrew Tridgell 2013-12-29 14:59:35 +11:00
parent f35cf2beba
commit a43e0f6f31
2 changed files with 2 additions and 0 deletions

View File

@ -156,6 +156,7 @@ uint16_t DataFlash_Block::GetFilePage()
void DataFlash_Block::EraseAll() void DataFlash_Block::EraseAll()
{ {
log_write_started = false;
for (uint16_t j = 1; j <= (df_NumPages+1)/8; j++) { for (uint16_t j = 1; j <= (df_NumPages+1)/8; j++) {
BlockErase(j); BlockErase(j);
if (j%6 == 0) { if (j%6 == 0) {

View File

@ -113,6 +113,7 @@ char *DataFlash_File::_lastlog_file_name(void)
void DataFlash_File::EraseAll() void DataFlash_File::EraseAll()
{ {
uint16_t log_num; uint16_t log_num;
stop_logging();
for (log_num=0; log_num<MAX_LOG_FILES; log_num++) { for (log_num=0; log_num<MAX_LOG_FILES; log_num++) {
char *fname = _log_file_name(log_num); char *fname = _log_file_name(log_num);
if (fname == NULL) { if (fname == NULL) {