From c9699d7ce446641231117787aa57f60507f9462e Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 30 Jul 2021 13:18:05 +1000 Subject: [PATCH] AP_GPS: log GPS primary change event in GPS library --- libraries/AP_GPS/AP_GPS.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libraries/AP_GPS/AP_GPS.cpp b/libraries/AP_GPS/AP_GPS.cpp index 0b103270f7..0c9fd1833c 100644 --- a/libraries/AP_GPS/AP_GPS.cpp +++ b/libraries/AP_GPS/AP_GPS.cpp @@ -925,7 +925,15 @@ void AP_GPS::update(void) } } +#if HAL_LOGGING_ENABLED + const uint8_t old_primary = primary_instance; +#endif update_primary(); +#if HAL_LOGGING_ENABLED + if (primary_instance != old_primary) { + AP::logger().Write_Event(LogEvent::GPS_PRIMARY_CHANGED); + } +#endif #ifndef HAL_BUILD_AP_PERIPH // update notify with gps status. We always base this on the primary_instance