only set time valid if at least 1 sat in view #501

Merged
meggert merged 2 commits from bugfix_gps into develop 2023-03-21 13:41:27 +01:00
2 changed files with 5 additions and 1 deletions
Showing only changes of commit ab74382c12 - Show all commits

View File

@ -28,6 +28,7 @@ will consitute of a breaking change warranting a new major release:
- Fixed transition for dual power lane assemblies: When going from dual side submode to single side - Fixed transition for dual power lane assemblies: When going from dual side submode to single side
submode, perform logical commanding first, similarly to when going to OFF mode. submode, perform logical commanding first, similarly to when going to OFF mode.
- GPS time is only set to valid if at least one satellite is in view.
## Changed ## Changed

View File

@ -302,7 +302,10 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
// TIME is set for every message, no need for a counter // TIME is set for every message, no need for a counter
bool timeValid = false; bool timeValid = false;
if (TIME_SET == (TIME_SET & gps.set)) { if (TIME_SET == (TIME_SET & gps.set)) {
timeValid = true; // To prevent totally incorrect times from being declared valid.
if(gpsSet.satInView.isValid() and gpsSet.satInView.value >= 1) {
timeValid = true;
}
timeval time = {}; timeval time = {};
#if LIBGPS_VERSION_MINOR <= 17 #if LIBGPS_VERSION_MINOR <= 17
gpsSet.unixSeconds.value = std::floor(gps.fix.time); gpsSet.unixSeconds.value = std::floor(gps.fix.time);