More improvements for gps handler #400
@ -16,6 +16,11 @@ will consitute of a breaking change warranting a new major release:
|
|||||||
|
|
||||||
# [unreleased]
|
# [unreleased]
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- Linux GPS handler now checks the individual `*_SET` flags when analysing the `gpsd` struct.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/400
|
||||||
|
|
||||||
# [v1.32.0]
|
# [v1.32.0]
|
||||||
|
|
||||||
eive-tmtc: v2.16.1
|
eive-tmtc: v2.16.1
|
||||||
|
@ -195,7 +195,7 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
|
|||||||
if (MODE_SET != (MODE_SET & gps.set)) {
|
if (MODE_SET != (MODE_SET & gps.set)) {
|
||||||
if (mode != MODE_OFF) {
|
if (mode != MODE_OFF) {
|
||||||
if (maxTimeToReachFix.hasTimedOut() and oneShotSwitches.cantGetFixSwitch) {
|
if (maxTimeToReachFix.hasTimedOut() and oneShotSwitches.cantGetFixSwitch) {
|
||||||
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: No mode could be set in allowed "
|
sif::warning << "GpsHyperionLinuxController: No mode could be set in allowed "
|
||||||
<< maxTimeToReachFix.timeout / 1000 << " seconds" << std::endl;
|
<< maxTimeToReachFix.timeout / 1000 << " seconds" << std::endl;
|
||||||
triggerEvent(GpsHyperion::CANT_GET_FIX, maxTimeToReachFix.timeout);
|
triggerEvent(GpsHyperion::CANT_GET_FIX, maxTimeToReachFix.timeout);
|
||||||
oneShotSwitches.cantGetFixSwitch = false;
|
oneShotSwitches.cantGetFixSwitch = false;
|
||||||
@ -237,15 +237,25 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
|
|||||||
}
|
}
|
||||||
gpsSet.fixMode.setValid(modeIsSet);
|
gpsSet.fixMode.setValid(modeIsSet);
|
||||||
|
|
||||||
bool satInfoValid = false;
|
// Only set on specific messages, so only set a valid flag to invalid
|
||||||
|
// if not set for more than a full message set (10 messages here)
|
||||||
if (SATELLITE_SET == (SATELLITE_SET & gps.set)) {
|
if (SATELLITE_SET == (SATELLITE_SET & gps.set)) {
|
||||||
satInfoValid = true;
|
|
||||||
gpsSet.satInUse.value = gps.satellites_used;
|
gpsSet.satInUse.value = gps.satellites_used;
|
||||||
gpsSet.satInView.value = gps.satellites_visible;
|
gpsSet.satInView.value = gps.satellites_visible;
|
||||||
|
if (not gpsSet.satInUse.isValid()) {
|
||||||
|
gpsSet.satInUse.setValid(true);
|
||||||
|
gpsSet.satInView.setValid(true);
|
||||||
|
}
|
||||||
|
satNotSetCounter = 0;
|
||||||
|
} else {
|
||||||
|
satNotSetCounter++;
|
||||||
|
if (gpsSet.satInUse.isValid() and satNotSetCounter >= 10) {
|
||||||
|
gpsSet.satInUse.setValid(false);
|
||||||
|
gpsSet.satInView.setValid(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
gpsSet.satInUse.setValid(satInfoValid);
|
|
||||||
gpsSet.satInView.setValid(satInfoValid);
|
|
||||||
|
|
||||||
|
// LATLON is set for every message, no need for a counter
|
||||||
bool latValid = false;
|
bool latValid = false;
|
||||||
bool longValid = false;
|
bool longValid = false;
|
||||||
if (LATLON_SET == (LATLON_SET & gps.set)) {
|
if (LATLON_SET == (LATLON_SET & gps.set)) {
|
||||||
@ -270,6 +280,7 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
|
|||||||
gpsSet.latitude.setValid(latValid);
|
gpsSet.latitude.setValid(latValid);
|
||||||
gpsSet.longitude.setValid(longValid);
|
gpsSet.longitude.setValid(longValid);
|
||||||
|
|
||||||
|
// ALTITUDE is set for every message, no need for a counter
|
||||||
bool altitudeValid = false;
|
bool altitudeValid = false;
|
||||||
if (ALTITUDE_SET == (ALTITUDE_SET & gps.set) && std::isfinite(gps.fix.altitude)) {
|
if (ALTITUDE_SET == (ALTITUDE_SET & gps.set) && std::isfinite(gps.fix.altitude)) {
|
||||||
gpsSet.altitude.value = gps.fix.altitude;
|
gpsSet.altitude.value = gps.fix.altitude;
|
||||||
@ -280,6 +291,7 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
|
|||||||
}
|
}
|
||||||
gpsSet.altitude.setValid(altitudeValid);
|
gpsSet.altitude.setValid(altitudeValid);
|
||||||
|
|
||||||
|
// SPEED is set for every message, no need for a counter
|
||||||
bool speedValid = false;
|
bool speedValid = false;
|
||||||
if (SPEED_SET == (SPEED_SET & gps.set) && std::isfinite(gps.fix.speed)) {
|
if (SPEED_SET == (SPEED_SET & gps.set) && std::isfinite(gps.fix.speed)) {
|
||||||
gpsSet.speed.value = gps.fix.speed;
|
gpsSet.speed.value = gps.fix.speed;
|
||||||
@ -287,6 +299,7 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
|
|||||||
}
|
}
|
||||||
gpsSet.speed.setValid(speedValid);
|
gpsSet.speed.setValid(speedValid);
|
||||||
|
|
||||||
|
// 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;
|
timeValid = true;
|
||||||
|
@ -61,6 +61,8 @@ class GpsHyperionLinuxController : public ExtendedControllerBase {
|
|||||||
Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000);
|
Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000);
|
||||||
bool modeCommanded = false;
|
bool modeCommanded = false;
|
||||||
bool timeInit = false;
|
bool timeInit = false;
|
||||||
|
uint8_t satNotSetCounter = 0;
|
||||||
|
|
||||||
#if OBSW_THREAD_TRACING == 1
|
#if OBSW_THREAD_TRACING == 1
|
||||||
uint32_t opCounter = 0;
|
uint32_t opCounter = 0;
|
||||||
#endif
|
#endif
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit 13014eb25053368f4fb9a445788aba71ff98de19
|
Subproject commit 9720fcddecb04b228dc5eb0d064f15a12ef8daca
|
Loading…
x
Reference in New Issue
Block a user