From c3f401111f73e64f5216148d13b7188237303e98 Mon Sep 17 00:00:00 2001 From: z Date: Sat, 27 Jun 2020 07:49:48 +0800 Subject: [PATCH] add log num --- .gitignore | 2 ++ ArduCopter/Parameters.cpp | 2 +- ArduCopter/version.h | 2 +- libraries/AP_Logger/AP_Logger.cpp | 4 ++++ libraries/AP_Logger/AP_Logger.h | 3 +++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index dc6fb1ed6e..531d9f0e1b 100644 --- a/.gitignore +++ b/.gitignore @@ -123,3 +123,5 @@ segv_*out /ArduPlane/scripts/ /ArduSub/scripts/ persistent.dat +.history + diff --git a/ArduCopter/Parameters.cpp b/ArduCopter/Parameters.cpp index aa39fcdc59..0aba8c2238 100644 --- a/ArduCopter/Parameters.cpp +++ b/ArduCopter/Parameters.cpp @@ -1633,7 +1633,7 @@ const char* Copter::get_sysid_board_id(void) int32_t nameValue2 = (int32_t)g.sysid_board_name_2nd; // snprintf(buf, sizeof(buf), "Version: zr-v4.0.1 ,Board ID: ZRZK.20QT2.%d",(int)nameValue2); - snprintf(buf, sizeof(buf), "Version: zr-v4.0.2 ,ID: RS100%04d%05d",(int)nameValue1,(int)nameValue2); + snprintf(buf, sizeof(buf), "Version: zr-v4.0.3 ,ID: RS100%04d%05d",(int)nameValue1,(int)nameValue2); AP::logger().Write_Message(buf); return buf; } diff --git a/ArduCopter/version.h b/ArduCopter/version.h index c3e8eec28c..bf3e229cd2 100644 --- a/ArduCopter/version.h +++ b/ArduCopter/version.h @@ -9,7 +9,7 @@ #define THISFIRMWARE "ZRUAV" //"ArduCopter V4.0.0" // the following line is parsed by the autotest scripts -#define FIRMWARE_VERSION 4,0,0,FIRMWARE_VERSION_TYPE_OFFICIAL +#define FIRMWARE_VERSION 4,0,3,FIRMWARE_VERSION_TYPE_OFFICIAL #define FW_MAJOR 4 #define FW_MINOR 0 diff --git a/libraries/AP_Logger/AP_Logger.cpp b/libraries/AP_Logger/AP_Logger.cpp index 697db9dd00..bd7ba49d97 100644 --- a/libraries/AP_Logger/AP_Logger.cpp +++ b/libraries/AP_Logger/AP_Logger.cpp @@ -92,6 +92,9 @@ const AP_Param::GroupInfo AP_Logger::var_info[] = { // @User: Standard // @Units: s AP_GROUPINFO("_FILE_TIMEOUT", 6, AP_Logger, _params.file_timeout, HAL_LOGGING_FILE_TIMEOUT), + + AP_GROUPINFO("_LAST_LOG", 7, AP_Logger, _params.last_log_num, 0), + AP_GROUPEND }; @@ -211,6 +214,7 @@ void AP_Logger::Init(const struct LogStructure *structures, uint8_t num_types) EnableWrites(true); gcs().send_text(MAV_SEVERITY_INFO, "Prepared log system"); + set_last_log_num(); } #if CONFIG_HAL_BOARD == HAL_BOARD_SITL diff --git a/libraries/AP_Logger/AP_Logger.h b/libraries/AP_Logger/AP_Logger.h index 79f63d97d2..68302baf18 100644 --- a/libraries/AP_Logger/AP_Logger.h +++ b/libraries/AP_Logger/AP_Logger.h @@ -338,8 +338,11 @@ public: AP_Int8 log_replay; AP_Int8 mav_bufsize; // in kilobytes AP_Int16 file_timeout; // in seconds + AP_Int16 last_log_num; // in seconds } _params; + void set_last_log_num() { _params.last_log_num = find_last_log() ; } + const struct LogStructure *structure(uint16_t num) const; const struct UnitStructure *unit(uint16_t num) const; const struct MultiplierStructure *multiplier(uint16_t num) const;