GNSS Ctrl Improvements #871

Merged
meggert merged 24 commits from gnss-ctrl-improvements into main 2024-04-10 11:40:24 +02:00
2 changed files with 6 additions and 15 deletions
Showing only changes of commit 8fe7307a58 - Show all commits

View File

@ -44,17 +44,13 @@ LocalPoolDataSetBase *GpsHyperionLinuxController::getDataSetHandle(sid_t sid) {
ReturnValue_t GpsHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_t submode, ReturnValue_t GpsHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode) { uint32_t *msToReachTheMode) {
if (not modeCommanded) { if (mode == MODE_ON) {
if (mode == MODE_ON or mode == MODE_OFF) { maxTimeToReachFix.resetTimer();
// 5h time to reach fix } else if (mode == MODE_NORMAL) {
*msToReachTheMode = MAX_SECONDS_TO_REACH_FIX; return HasModesIF::INVALID_MODE;
maxTimeToReachFix.resetTimer();
modeCommanded = true;
} else if (mode == MODE_NORMAL) {
return HasModesIF::INVALID_MODE;
}
} }
if (mode == MODE_OFF) { if (mode == MODE_OFF) {
maxTimeToReachFix.timeOut();
PoolReadGuard pg(&gpsSet); PoolReadGuard pg(&gpsSet);
gpsSet.setValidity(false, true); gpsSet.setValidity(false, true);
// There can't be a fix with a device that is off. // There can't be a fix with a device that is off.
@ -62,7 +58,6 @@ ReturnValue_t GpsHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_
handleFixChangedEvent(GpsHyperion::FixMode::NOT_SEEN); handleFixChangedEvent(GpsHyperion::FixMode::NOT_SEEN);
gpsSet.fixMode.value = GpsHyperion::FixMode::NOT_SEEN; gpsSet.fixMode.value = GpsHyperion::FixMode::NOT_SEEN;
oneShotSwitches.reset(); oneShotSwitches.reset();
modeCommanded = false;
} }
return returnvalue::OK; return returnvalue::OK;
} }
@ -261,10 +256,7 @@ ReturnValue_t GpsHyperionLinuxController::handleCoreTelemetry(bool modeIsSet) {
if (newFix == GpsHyperion::FixMode::NOT_SEEN or newFix == GpsHyperion::FixMode::NO_FIX) { if (newFix == GpsHyperion::FixMode::NOT_SEEN or newFix == GpsHyperion::FixMode::NO_FIX) {
if (modeCommanded and maxTimeToReachFix.hasTimedOut()) { if (modeCommanded and maxTimeToReachFix.hasTimedOut()) {
// We are supposed to be on and functioning, but no fix was found // We are supposed to be on and functioning, but no fix was found
if (mode == MODE_ON or mode == MODE_NORMAL) { // ToDo:: maybe pull reset pins here
mode = MODE_OFF;
}
modeCommanded = false;
} }
} }
} }

View File

@ -66,7 +66,6 @@ class GpsHyperionLinuxController : public ExtendedControllerBase {
Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000); Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000);
Countdown gainedNewFix = Countdown(60 * 2 * 1000); Countdown gainedNewFix = Countdown(60 * 2 * 1000);
uint32_t fixChangeCounter = 0; uint32_t fixChangeCounter = 0;
bool modeCommanded = false;
bool timeInit = false; bool timeInit = false;
uint8_t satNotSetCounter = 0; uint8_t satNotSetCounter = 0;