some more tweaks
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-02-07 10:12:28 +01:00
parent c8e376a625
commit 07ca738842
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -225,25 +225,34 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
gpsSet.satInUse.value = gps.satellites_used; gpsSet.satInUse.value = gps.satellites_used;
gpsSet.satInView.value = gps.satellites_visible; gpsSet.satInView.value = gps.satellites_visible;
bool latValid = false;
if (std::isfinite(gps.fix.latitude)) { if (std::isfinite(gps.fix.latitude)) {
// Negative latitude -> South direction // Negative latitude -> South direction
gpsSet.latitude.value = gps.fix.latitude; gpsSet.latitude.value = gps.fix.latitude;
} else { if(gps.fix.mode >= 2) {
gpsSet.latitude.setValid(false); latValid = true;
} }
}
gpsSet.latitude.setValid(latValid);
bool longValid = false;
if (std::isfinite(gps.fix.longitude)) { if (std::isfinite(gps.fix.longitude)) {
// Negative longitude -> West direction // Negative longitude -> West direction
gpsSet.longitude.value = gps.fix.longitude; gpsSet.longitude.value = gps.fix.longitude;
} else { if(gps.fix.mode >= 2) {
gpsSet.longitude.setValid(false); longValid = true;
} }
}
gpsSet.latitude.setValid(longValid);
bool altitudeValid = false;
if (std::isfinite(gps.fix.altitude)) { if (std::isfinite(gps.fix.altitude)) {
gpsSet.altitude.value = gps.fix.altitude; gpsSet.altitude.value = gps.fix.altitude;
} else { if(gps.fix.mode == 3) {
gpsSet.altitude.setValid(false); altitudeValid = true;
} }
}
gpsSet.altitude.setValid(altitudeValid);
if (std::isfinite(gps.fix.speed)) { if (std::isfinite(gps.fix.speed)) {
gpsSet.speed.value = gps.fix.speed; gpsSet.speed.value = gps.fix.speed;
@ -277,7 +286,7 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
if (debugHyperionGps) { if (debugHyperionGps) {
sif::info << "-- Hyperion GPS Data --" << std::endl; sif::info << "-- Hyperion GPS Data --" << std::endl;
#if LIBGPS_VERSION_MINOR <= 17 #if LIBGPS_VERSION_MINOR <= 17
time_t timeRaw = gps.fix.time; time_t timeRaw = gpsSet.unixSeconds.value;
#else #else
time_t timeRaw = gps.fix.time.tv_sec; time_t timeRaw = gps.fix.time.tv_sec;
#endif #endif