This commit is contained in:
parent
c8e376a625
commit
07ca738842
@ -225,25 +225,34 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
|
||||
gpsSet.satInUse.value = gps.satellites_used;
|
||||
gpsSet.satInView.value = gps.satellites_visible;
|
||||
|
||||
bool latValid = false;
|
||||
if (std::isfinite(gps.fix.latitude)) {
|
||||
// Negative latitude -> South direction
|
||||
gpsSet.latitude.value = gps.fix.latitude;
|
||||
} else {
|
||||
gpsSet.latitude.setValid(false);
|
||||
if(gps.fix.mode >= 2) {
|
||||
latValid = true;
|
||||
}
|
||||
}
|
||||
gpsSet.latitude.setValid(latValid);
|
||||
|
||||
bool longValid = false;
|
||||
if (std::isfinite(gps.fix.longitude)) {
|
||||
// Negative longitude -> West direction
|
||||
gpsSet.longitude.value = gps.fix.longitude;
|
||||
} else {
|
||||
gpsSet.longitude.setValid(false);
|
||||
if(gps.fix.mode >= 2) {
|
||||
longValid = true;
|
||||
}
|
||||
}
|
||||
gpsSet.latitude.setValid(longValid);
|
||||
|
||||
bool altitudeValid = false;
|
||||
if (std::isfinite(gps.fix.altitude)) {
|
||||
gpsSet.altitude.value = gps.fix.altitude;
|
||||
} else {
|
||||
gpsSet.altitude.setValid(false);
|
||||
if(gps.fix.mode == 3) {
|
||||
altitudeValid = true;
|
||||
}
|
||||
}
|
||||
gpsSet.altitude.setValid(altitudeValid);
|
||||
|
||||
if (std::isfinite(gps.fix.speed)) {
|
||||
gpsSet.speed.value = gps.fix.speed;
|
||||
@ -277,7 +286,7 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
|
||||
if (debugHyperionGps) {
|
||||
sif::info << "-- Hyperion GPS Data --" << std::endl;
|
||||
#if LIBGPS_VERSION_MINOR <= 17
|
||||
time_t timeRaw = gps.fix.time;
|
||||
time_t timeRaw = gpsSet.unixSeconds.value;
|
||||
#else
|
||||
time_t timeRaw = gps.fix.time.tv_sec;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user