Sub: simplify start_logging

This commit is contained in:
Peter Barker 2017-06-09 11:57:42 +10:00 committed by Randy Mackay
parent df0e9029b0
commit 67a5c1dfc0
1 changed files with 16 additions and 13 deletions

View File

@ -466,22 +466,25 @@ void Sub::Log_Write_Vehicle_Startup_Messages()
} }
// start a new log
void Sub::start_logging() void Sub::start_logging()
{ {
if (g.log_bitmask != 0 && !in_log_download) { if (g.log_bitmask == 0) {
if (!ap.logging_started) { return;
}
if (in_log_download) {
return;
}
ap.logging_started = true; ap.logging_started = true;
DataFlash.StartNewLog();
} else if (!DataFlash.logging_started()) {
hal.console->println("Starting new log");
// dataflash may have stopped logging - when we get_log_data, // dataflash may have stopped logging - when we get_log_data,
// for example. Try to restart: // for example. Always try to restart:
if (!DataFlash.logging_started()) {
DataFlash.StartNewLog(); DataFlash.StartNewLog();
} }
// enable writes // enable writes
DataFlash.EnableWrites(true); DataFlash.EnableWrites(true);
}
} }
void Sub::log_init(void) void Sub::log_init(void)