diff --git a/CHANGELOG.md b/CHANGELOG.md index 34740937..61aa3ba3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ will consitute of a breaking change warranting a new major release: - Skyview dataset for more GPS TM has been added +## 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 diff --git a/linux/acs/GpsHyperionLinuxController.cpp b/linux/acs/GpsHyperionLinuxController.cpp index b41661ec..68a8cc2f 100644 --- a/linux/acs/GpsHyperionLinuxController.cpp +++ b/linux/acs/GpsHyperionLinuxController.cpp @@ -184,30 +184,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)) { - if (-1 == gps_read(&gps)) { + while (gps_waiting(&gps, 0)) { + int retval = gps_read(&gps); + if (retval < 0) { readError(); return false; } - oneShotSwitches.gpsReadFailedSwitch = true; - ReturnValue_t result = handleGpsReadData(); - if (result == returnvalue::OK) { - return true; - } else { - return false; + readIdx++; + if (readIdx >= 40) { + sif::warning << "GpsHyperionLinuxController: Received " << readIdx + << " GPSD message consecutively" << std::endl; + break; } - noModeSetCntr = 0; - } else { - return false; + } + 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() { diff --git a/linux/acs/GpsHyperionLinuxController.h b/linux/acs/GpsHyperionLinuxController.h index c2d068bb..3378ac55 100644 --- a/linux/acs/GpsHyperionLinuxController.h +++ b/linux/acs/GpsHyperionLinuxController.h @@ -84,7 +84,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.