From 6b8c31f8821cbdd375b257bcef7e0e38c6f3b98a Mon Sep 17 00:00:00 2001 From: David Anthony Date: Thu, 9 May 2024 14:03:09 -0500 Subject: [PATCH] Port of PR #89 (#97) * Port of PR #89 * Fixing variable name --- gpsd_client/src/client.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gpsd_client/src/client.cpp b/gpsd_client/src/client.cpp index 736bfef..1642ae3 100644 --- a/gpsd_client/src/client.cpp +++ b/gpsd_client/src/client.cpp @@ -59,7 +59,12 @@ class GPSDClient { if (!gps->waiting(1e6)) return; - gps_data_t *p = gps->read(); + // Read out all queued data and only act on the latest + gps_data_t* p = NULL; + while (gps->waiting(0)) + { + p = gps->read(); + } #else gps_data_t *p = gps->poll(); #endif