From 494d72503ac353a17d955d8fe72442d3df4f1595 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 19 Feb 2024 10:57:18 +1100 Subject: [PATCH] AP_GPS: use probing when probing for GPS, add detected message --- libraries/AP_GPS/AP_GPS.cpp | 8 ++++++++ libraries/AP_GPS/AP_GPS.h | 1 + libraries/AP_GPS/GPS_Backend.cpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libraries/AP_GPS/AP_GPS.cpp b/libraries/AP_GPS/AP_GPS.cpp index 25a790787a..52f622458e 100644 --- a/libraries/AP_GPS/AP_GPS.cpp +++ b/libraries/AP_GPS/AP_GPS.cpp @@ -999,6 +999,14 @@ void AP_GPS::update_instance(uint8_t instance) tnow = state[instance].last_corrected_gps_time_us/1000U; state[instance].corrected_timestamp_updated = false; } + + // we set delta_time_ms to the timeout value when clearing + // state; use it being zero to mark first message + if (!state[instance].announced_detection) { + state[instance].announced_detection = true; + GCS_SEND_TEXT(MAV_SEVERITY_INFO, "GPS %d: detected %s", instance + 1, drivers[instance]->name()); + } + // delta will only be correct after parsing two messages timing[instance].delta_time_ms = tnow - timing[instance].last_message_time_ms; timing[instance].last_message_time_ms = tnow; diff --git a/libraries/AP_GPS/AP_GPS.h b/libraries/AP_GPS/AP_GPS.h index a5ca9cdcea..b48bf453a4 100644 --- a/libraries/AP_GPS/AP_GPS.h +++ b/libraries/AP_GPS/AP_GPS.h @@ -212,6 +212,7 @@ public: float undulation; //snprintf(buffer, buflen, - "GPS %d: detected as %s at %d baud", + "GPS %d: probing for %s at %d baud", instance + 1, name(), int(gps._baudrates[dstate.current_baud]));