From 574f95bd7680ab565b7db3672508e50d88f925c2 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 10 Nov 2015 09:40:34 +1100 Subject: [PATCH] Plane: support multiple simultaneous backends --- ArduPlane/Log.cpp | 5 ++--- ArduPlane/Parameters.cpp | 4 ++++ ArduPlane/Parameters.h | 2 ++ ArduPlane/Plane.h | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ArduPlane/Log.cpp b/ArduPlane/Log.cpp index 53a9965f8e..c2b3505867 100644 --- a/ArduPlane/Log.cpp +++ b/ArduPlane/Log.cpp @@ -222,8 +222,7 @@ struct PACKED log_Startup { uint16_t command_total; }; -// do not add any extra log writes to this function; see LogStartup.cpp -bool Plane::Log_Write_Startup(uint8_t type) +void Plane::Log_Write_Startup(uint8_t type) { struct log_Startup pkt = { LOG_PACKET_HEADER_INIT(LOG_STARTUP_MSG), @@ -231,7 +230,7 @@ bool Plane::Log_Write_Startup(uint8_t type) startup_type : type, command_total : mission.num_commands() }; - return DataFlash.WriteBlock(&pkt, sizeof(pkt)); + DataFlash.WriteBlock(&pkt, sizeof(pkt)); } struct PACKED log_Control_Tuning { diff --git a/ArduPlane/Parameters.cpp b/ArduPlane/Parameters.cpp index 37b08ac0f5..ef173e0459 100644 --- a/ArduPlane/Parameters.cpp +++ b/ArduPlane/Parameters.cpp @@ -1158,6 +1158,10 @@ const AP_Param::Info Plane::var_info[] = { GOBJECT(camera_mount, "MNT", AP_Mount), #endif + // @Group: LOG + // @Path: ../libraries/DataFlash/DataFlash.cpp + GOBJECT(DataFlash, "LOG", DataFlash_Class), + // @Group: BATT // @Path: ../libraries/AP_BattMonitor/AP_BattMonitor.cpp GOBJECT(battery, "BATT", AP_BattMonitor), diff --git a/ArduPlane/Parameters.h b/ArduPlane/Parameters.h index b1d926c5a6..8cdc2af4bf 100644 --- a/ArduPlane/Parameters.h +++ b/ArduPlane/Parameters.h @@ -324,6 +324,8 @@ public: k_param_pidNavPitchAltitude, // unused k_param_pidWheelSteer, // unused + k_param_DataFlash = 253, // Logging Group + // 254,255: reserved }; diff --git a/ArduPlane/Plane.h b/ArduPlane/Plane.h index 40216d70d0..b532aae989 100644 --- a/ArduPlane/Plane.h +++ b/ArduPlane/Plane.h @@ -738,7 +738,7 @@ private: void do_erase_logs(void); void Log_Write_Attitude(void); void Log_Write_Performance(); - bool Log_Write_Startup(uint8_t type); + void Log_Write_Startup(uint8_t type); void Log_Write_Control_Tuning(); void Log_Write_TECS_Tuning(void); void Log_Write_Nav_Tuning();