DataFlash: StartUnstartedLogging replaces logging_started/start_logging

This commit is contained in:
Peter Barker 2017-06-11 21:36:23 +10:00 committed by Randy Mackay
parent b2724852aa
commit cc7d75ea5d
3 changed files with 14 additions and 13 deletions

View File

@ -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) \ #define FOR_EACH_BACKEND(methodcall) \
do { \ do { \
for (uint8_t i=0; i<_next_backend; i++) { \ for (uint8_t i=0; i<_next_backend; i++) { \

View File

@ -105,7 +105,9 @@ public:
void setVehicle_Startup_Log_Writer(vehicle_startup_message_Log_Writer writer); 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 EnableWrites(bool enable);
void StopLogging(); void StopLogging();

View File

@ -582,18 +582,6 @@ void DataFlash_Block::ListAvailableLogs(AP_HAL::BetterStream *port)
port->printf("\n"); 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 write a structure format to the log - should be in frontend
*/ */