diff --git a/ArduCopter/Log_simple.pde b/ArduCopter/Log_simple.pde index 32f2ff67d4..4c122a33f9 100644 --- a/ArduCopter/Log_simple.pde +++ b/ArduCopter/Log_simple.pde @@ -131,6 +131,22 @@ erase_logs(uint8_t argc, const Menu::arg *argv) return 0; } +static void +do_erase_logs(void (*delay_cb)(unsigned long)) +{ + Serial.printf_P(PSTR("\nErasing log...\n")); + DataFlash.SetFileNumber(0xFFFF); + for(int j = 1; j <= DF_LAST_PAGE; j++) { + DataFlash.PageErase(j); + DataFlash.StartWrite(j); // We need this step to clean FileNumbers + if(j%128 == 0) Serial.printf_P(PSTR("+")); + delay_cb(1); + } + + Serial.printf_P(PSTR("\nLog erased.\n")); + DataFlash.FinishWrite(); +} + static int8_t process_logs(uint8_t argc, const Menu::arg *argv) {