From 388dc0a813c93fadcf9ce5a2fb7ceb6db3cc8405 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 2 Aug 2023 13:40:51 +0200 Subject: [PATCH 1/3] gps event spam fix? --- linux/acs/GpsHyperionLinuxController.cpp | 17 ++++++++--------- linux/acs/GpsHyperionLinuxController.h | 1 - 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/linux/acs/GpsHyperionLinuxController.cpp b/linux/acs/GpsHyperionLinuxController.cpp index 900de0aa..afa73f77 100644 --- a/linux/acs/GpsHyperionLinuxController.cpp +++ b/linux/acs/GpsHyperionLinuxController.cpp @@ -169,18 +169,17 @@ bool GpsHyperionLinuxController::readGpsDataFromGpsd() { if (readMode == ReadModes::SOCKET) { // Poll the GPS. if (gps_waiting(&gps, 0)) { - if (-1 == gps_read(&gps)) { + int retval = gps_read(&gps); + if (retval < 0) { readError(); return false; + } else if (retval == 0) { + oneShotSwitches.gpsReadFailedSwitch = true; + ReturnValue_t result = handleGpsReadData(); + if (result != returnvalue::OK) { + return false; + } } - oneShotSwitches.gpsReadFailedSwitch = true; - ReturnValue_t result = handleGpsReadData(); - if (result == returnvalue::OK) { - return true; - } else { - return false; - } - noModeSetCntr = 0; } else { return false; } diff --git a/linux/acs/GpsHyperionLinuxController.h b/linux/acs/GpsHyperionLinuxController.h index d5b1f637..5a8494dd 100644 --- a/linux/acs/GpsHyperionLinuxController.h +++ b/linux/acs/GpsHyperionLinuxController.h @@ -81,7 +81,6 @@ class GpsHyperionLinuxController : public ExtendedControllerBase { } oneShotSwitches; bool debugHyperionGps = false; - int32_t noModeSetCntr = 0; // Returns true if the function should be called again or false if other // controller handling can be done. From 8441c49fe67616512882bd73300eb0baa48d08da Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 2 Aug 2023 16:00:27 +0200 Subject: [PATCH 2/3] big gps victory --- linux/acs/GpsHyperionLinuxController.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/linux/acs/GpsHyperionLinuxController.cpp b/linux/acs/GpsHyperionLinuxController.cpp index afa73f77..b451c112 100644 --- a/linux/acs/GpsHyperionLinuxController.cpp +++ b/linux/acs/GpsHyperionLinuxController.cpp @@ -166,29 +166,32 @@ bool GpsHyperionLinuxController::readGpsDataFromGpsd() { if (mode == MODE_OFF) { return false; } + unsigned int readIdx = 0; if (readMode == ReadModes::SOCKET) { // Poll the GPS. - if (gps_waiting(&gps, 0)) { + while (gps_waiting(&gps, 0)) { int retval = gps_read(&gps); if (retval < 0) { readError(); return false; - } else if (retval == 0) { - oneShotSwitches.gpsReadFailedSwitch = true; - ReturnValue_t result = handleGpsReadData(); - if (result != returnvalue::OK) { - return false; - } } - } else { - return false; + readIdx++; + if (readIdx >= 40) { + sif::warning << "GpsHyperionLinuxController: Received " << readIdx + << " GPSD message consecutively" << std::endl; + break; + } + } + if (readIdx > 0) { + oneShotSwitches.gpsReadFailedSwitch = true; + handleGpsReadData(); } } else if (readMode == ReadModes::SHM) { sif::error << "GpsHyperionLinuxController::readGpsDataFromGpsdPermanentLoop: " "SHM read not implemented" << std::endl; } - return true; + return false; } ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() { From 8f8c3fd4a26b4d45953e5f1b15efe65879f3e099 Mon Sep 17 00:00:00 2001 From: meggert Date: Mon, 7 Aug 2023 17:00:19 +0200 Subject: [PATCH 3/3] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18ba4097..7f1f275c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Fixed +- The handling function of the GPS data is only called once per GPS read. This should remove + the fake fix-has-changed events. + # [v6.3.0] 2023-08-03 ## Fixed