From 01cad1c4aa4b934d3724c435a5b0e1951687ec79 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 19 Dec 2022 08:01:41 +1100 Subject: [PATCH] SITL: added SIM_GPS_LOG_NUM for replaying GPS logs recorded with --enable-gps-logging --- libraries/SITL/SIM_GPS.cpp | 2 +- libraries/SITL/SITL.cpp | 2 ++ libraries/SITL/SITL.h | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/SITL/SIM_GPS.cpp b/libraries/SITL/SIM_GPS.cpp index 5e5b732b5f..0b2735a197 100644 --- a/libraries/SITL/SIM_GPS.cpp +++ b/libraries/SITL/SIM_GPS.cpp @@ -1023,7 +1023,7 @@ void GPS::update_file() { static int fd[2] = {-1,-1}; static uint32_t base_time[2]; - const uint16_t lognum = 9; + const uint16_t lognum = uint16_t(_sitl->gps_log_num.get()); if (instance > 1) { return; } diff --git a/libraries/SITL/SITL.cpp b/libraries/SITL/SITL.cpp index 954cd23588..f4387c2cd1 100644 --- a/libraries/SITL/SITL.cpp +++ b/libraries/SITL/SITL.cpp @@ -376,6 +376,8 @@ const AP_Param::GroupInfo SIM::var_gps[] = { AP_GROUPINFO("INIT_LON_OFS", 46, SIM, gps_init_lon_ofs, 0), AP_GROUPINFO("INIT_ALT_OFS", 47, SIM, gps_init_alt_ofs, 0), + AP_GROUPINFO("GPS_LOG_NUM", 48, SIM, gps_log_num, 0), + AP_GROUPEND }; #endif // HAL_SIM_GPS_ENABLED diff --git a/libraries/SITL/SITL.h b/libraries/SITL/SITL.h index 7a2151a52a..a3d46d84a6 100644 --- a/libraries/SITL/SITL.h +++ b/libraries/SITL/SITL.h @@ -209,6 +209,9 @@ public: AP_Float gps_init_lon_ofs; AP_Float gps_init_alt_ofs; + // log number for GPS::update_file() + AP_Int16 gps_log_num; + AP_Float batt_voltage; // battery voltage base AP_Float batt_capacity_ah; // battery capacity in Ah AP_Int8 rc_fail; // fail RC input