AP_Logger: disallow log creation in main thread when armed
this fixes an issue where the sd card fails in flight and then re-mounts. When that happens the logging backend can trigger a new log open. That causes filesystem operations in the main thread while flying. That can cause long delays or even a watchdog. Thanks to Giacomo for noticing this on his flying wing
This commit is contained in:
parent
fd792bebf8
commit
1279772d92
@ -435,6 +435,17 @@ bool AP_Logger_File::StartNewLogOK() const
|
||||
if (recent_open_error()) {
|
||||
return false;
|
||||
}
|
||||
if (hal.scheduler->in_main_thread() &&
|
||||
hal.util->get_soft_armed() &&
|
||||
AP_HAL::millis() - hal.util->get_last_armed_change() > 3000) {
|
||||
// when we create the log while arming we are armed and the
|
||||
// creation is in the main loop. We generally don't want to
|
||||
// allow logs to start in main thread while armed, but we
|
||||
// have an exception for the first 3s after arming to allow
|
||||
// for the normal arming process to work. This can be removed
|
||||
// when we move log creation to the logging thread
|
||||
return false;
|
||||
}
|
||||
return AP_Logger_Backend::StartNewLogOK();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user