diff --git a/libraries/DataFlash/DataFlash.cpp b/libraries/DataFlash/DataFlash.cpp index 4fb81123f0..cdaaa06389 100644 --- a/libraries/DataFlash/DataFlash.cpp +++ b/libraries/DataFlash/DataFlash.cpp @@ -278,6 +278,17 @@ void DataFlash_Class::backend_starting_new_log(const DataFlash_Backend *backend) } } +// start any backend which hasn't started; this is only called from +// the vehicle code +void DataFlash_Class::StartUnstartedLogging(void) +{ + for (uint8_t i=0; i<_next_backend; i++) { + if (!backends[i]->logging_started()) { + backends[i]->start_new_log(); + } + } +} + #define FOR_EACH_BACKEND(methodcall) \ do { \ for (uint8_t i=0; i<_next_backend; i++) { \ diff --git a/libraries/DataFlash/DataFlash.h b/libraries/DataFlash/DataFlash.h index 5b4454e1c8..fc0f16cf5b 100644 --- a/libraries/DataFlash/DataFlash.h +++ b/libraries/DataFlash/DataFlash.h @@ -105,7 +105,9 @@ public: void setVehicle_Startup_Log_Writer(vehicle_startup_message_Log_Writer writer); - void StartNewLog(void); + /* poke backends to start if they're not already started */ + void StartUnstartedLogging(void); + void EnableWrites(bool enable); void StopLogging(); diff --git a/libraries/DataFlash/LogFile.cpp b/libraries/DataFlash/LogFile.cpp index 07ea2bce49..ff312a0b5e 100644 --- a/libraries/DataFlash/LogFile.cpp +++ b/libraries/DataFlash/LogFile.cpp @@ -582,18 +582,6 @@ void DataFlash_Block::ListAvailableLogs(AP_HAL::BetterStream *port) port->printf("\n"); } -// This function starts a new log file in the DataFlash, and writes -// the format of supported messages in the log -// This function is ONLY called from the vehicle code. -// DataFlash_MAVLink, for example, will NOT call this function if the -// remote end disconnects and reconnects! -void DataFlash_Class::StartNewLog(void) -{ - for (uint8_t i=0; i<_next_backend; i++) { - backends[i]->start_new_log(); - } -} - /* write a structure format to the log - should be in frontend */