diff --git a/libraries/DataFlash/DataFlash.h b/libraries/DataFlash/DataFlash.h index 04c108974d..0e246fda21 100644 --- a/libraries/DataFlash/DataFlash.h +++ b/libraries/DataFlash/DataFlash.h @@ -44,6 +44,7 @@ public: /* logging methods common to all vehicles */ uint16_t StartNewLog(void); + void AddLogFormats(const struct LogStructure *structures, uint8_t num_types); void EnableWrites(bool enable) { _writes_enabled = enable; } void Log_Write_Format(const struct LogStructure *structure); void Log_Write_Parameter(const char *name, float value); @@ -387,6 +388,8 @@ struct PACKED log_Radio { { LOG_RADIO_MSG, sizeof(log_Radio), \ "RAD", "IBBBBBHH", "TimeMS,RSSI,RemRSSI,TxBuf,Noise,RemNoise,RxErrors,Fixed" } +// message types 0 to 100 reversed for vehicle specific use + // message types for common messages #define LOG_FORMAT_MSG 128 #define LOG_PARAMETER_MSG 129 @@ -408,6 +411,8 @@ struct PACKED log_Radio { #define LOG_CMD_MSG 145 #define LOG_RADIO_MSG 146 +// message types 200 to 210 reversed for GPS driver use + #include "DataFlash_Block.h" #include "DataFlash_File.h" diff --git a/libraries/DataFlash/LogFile.cpp b/libraries/DataFlash/LogFile.cpp index f5042424c7..0ce7870637 100644 --- a/libraries/DataFlash/LogFile.cpp +++ b/libraries/DataFlash/LogFile.cpp @@ -576,6 +576,16 @@ uint16_t DataFlash_Class::StartNewLog(void) return ret; } +// add new logging formats to the log. Used by libraries that want to +// add their own log messages +void DataFlash_Class::AddLogFormats(const struct LogStructure *structures, uint8_t num_types) +{ + // write new log formats + for (uint8_t i=0; i