From 43bae9aacd3bdd40f9710c5dc7ea3833880f08d8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 21 Jan 2024 10:46:50 +1100 Subject: [PATCH] AP_GPS: support newer M10 versions with L1L5 --- libraries/AP_GPS/AP_GPS_UBLOX.cpp | 37 ++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/libraries/AP_GPS/AP_GPS_UBLOX.cpp b/libraries/AP_GPS/AP_GPS_UBLOX.cpp index 0f8e7063e6bae..f073201373b55 100644 --- a/libraries/AP_GPS/AP_GPS_UBLOX.cpp +++ b/libraries/AP_GPS/AP_GPS_UBLOX.cpp @@ -50,6 +50,9 @@ // use this to enable debugging of moving baseline configs #define UBLOX_MB_DEBUGGING 0 +// debug VALGET/VALSET configuration +#define UBLOX_CFG_DEBUGGING 0 + extern const AP_HAL::HAL& hal; #if UBLOX_DEBUGGING @@ -78,6 +81,19 @@ extern const AP_HAL::HAL& hal; # define MB_Debug(fmt, args ...) #endif +#if UBLOX_CFG_DEBUGGING +#if defined(HAL_BUILD_AP_PERIPH) + extern "C" { + void can_printf(const char *fmt, ...); + } + # define CFG_Debug(fmt, args ...) do {can_printf("%s:%d: " fmt "\n", __FUNCTION__, __LINE__, ## args);} while(0) +#else + # define CFG_Debug(fmt, args ...) do {hal.console->printf("%s:%d: " fmt "\n", __FUNCTION__, __LINE__, ## args); hal.scheduler->delay(1); } while(0) +#endif +#else + # define CFG_Debug(fmt, args ...) +#endif + AP_GPS_UBLOX::AP_GPS_UBLOX(AP_GPS &_gps, AP_GPS::GPS_State &_state, AP_HAL::UARTDriver *_port, AP_GPS::GPS_Role _role) : AP_GPS_Backend(_gps, _state, _port), _next_message(STEP_PVT), @@ -1031,13 +1047,13 @@ AP_GPS_UBLOX::_parse_gps(void) likely this device does not support fetching multiple keys at once, go one at a time */ if (active_config.fetch_index == -1) { - Debug("NACK starting %u", unsigned(active_config.count)); + CFG_Debug("NACK starting %u", unsigned(active_config.count)); active_config.fetch_index = 0; } else { // the device does not support the config key we asked for, // consider the bit as done active_config.done_mask |= (1U<