mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 07:44:03 -04:00
APM: run mavlink loop while erasing logs
This commit is contained in:
parent
1807585b98
commit
8a7d064842
@ -142,8 +142,8 @@ dump_log(uint8_t argc, const Menu::arg *argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int8_t
|
||||
erase_logs(uint8_t argc, const Menu::arg *argv)
|
||||
static void
|
||||
do_erase_logs(void (*delay_cb)(unsigned long))
|
||||
{
|
||||
Serial.printf_P(PSTR("\nErasing log...\n"));
|
||||
DataFlash.SetFileNumber(0xFFFF);
|
||||
@ -151,10 +151,17 @@ erase_logs(uint8_t argc, const Menu::arg *argv)
|
||||
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
|
||||
erase_logs(uint8_t argc, const Menu::arg *argv)
|
||||
{
|
||||
do_erase_logs(delay);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,8 @@ static void run_cli(void)
|
||||
|
||||
static void init_ardupilot()
|
||||
{
|
||||
bool need_log_erase = false;
|
||||
|
||||
#if USB_MUX_PIN > 0
|
||||
// on the APM2 board we have a mux thet switches UART0 between
|
||||
// USB and the board header. If the right ArduPPM firmware is
|
||||
@ -136,7 +138,7 @@ static void init_ardupilot()
|
||||
// erase DataFlash on format version change
|
||||
#if LOGGING_ENABLED == ENABLED
|
||||
DataFlash.Init();
|
||||
erase_logs(NULL, NULL);
|
||||
need_log_erase = true;
|
||||
#endif
|
||||
|
||||
// save the current format version
|
||||
@ -174,6 +176,10 @@ static void init_ardupilot()
|
||||
|
||||
mavlink_system.sysid = g.sysid_this_mav;
|
||||
|
||||
if (need_log_erase) {
|
||||
gcs_send_text_P(SEVERITY_LOW, PSTR("ERASING LOGS"));
|
||||
do_erase_logs(mavlink_delay);
|
||||
}
|
||||
|
||||
#if HIL_MODE != HIL_MODE_ATTITUDE
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user