mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-05 19:19:18 +00:00
Fix publishing settings
This commit is contained in:
parent
94ce40ce58
commit
0b104fd030
@ -1055,6 +1055,8 @@ void GPS::down()
|
|||||||
}
|
}
|
||||||
// If update interval long enough (or softsleep unsupported): hardsleep instead
|
// If update interval long enough (or softsleep unsupported): hardsleep instead
|
||||||
setPowerState(GPS_HARDSLEEP, sleepTime);
|
setPowerState(GPS_HARDSLEEP, sleepTime);
|
||||||
|
// Reset the fix quality to 0, since we're off.
|
||||||
|
fixQual = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1114,6 +1116,7 @@ int32_t GPS::runOnce()
|
|||||||
shouldPublish = true;
|
shouldPublish = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool prev_fixQual = fixQual;
|
||||||
bool gotLoc = lookForLocation();
|
bool gotLoc = lookForLocation();
|
||||||
if (gotLoc && !hasValidLocation) { // declare that we have location ASAP
|
if (gotLoc && !hasValidLocation) { // declare that we have location ASAP
|
||||||
LOG_DEBUG("hasValidLocation RISING EDGE");
|
LOG_DEBUG("hasValidLocation RISING EDGE");
|
||||||
@ -1124,6 +1127,14 @@ int32_t GPS::runOnce()
|
|||||||
fixHoldEnds = lastFixStartMsec + 20000;
|
fixHoldEnds = lastFixStartMsec + 20000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gotLoc && prev_fixQual == 0) { // we've moved from no lock to lock
|
||||||
|
LOG_DEBUG("Probably just got a lock after turning back on.");
|
||||||
|
// Hold for 20secs after getting a lock to download ephemeris etc
|
||||||
|
lastFixStartMsec = millis();
|
||||||
|
fixHoldEnds = lastFixStartMsec + 20000;
|
||||||
|
shouldPublish = true; // Publish immediately, since next publish is at end of hold
|
||||||
|
}
|
||||||
|
|
||||||
bool tooLong = scheduling.searchedTooLong();
|
bool tooLong = scheduling.searchedTooLong();
|
||||||
if (tooLong)
|
if (tooLong)
|
||||||
LOG_WARN("Couldn't publish a valid location: didn't get a GPS lock in time");
|
LOG_WARN("Couldn't publish a valid location: didn't get a GPS lock in time");
|
||||||
@ -1140,11 +1151,12 @@ int32_t GPS::runOnce()
|
|||||||
hasValidLocation = false;
|
hasValidLocation = false;
|
||||||
}
|
}
|
||||||
if (millis() > fixHoldEnds) {
|
if (millis() > fixHoldEnds) {
|
||||||
|
shouldPublish = true; // publish our update at the end of the lock hold
|
||||||
|
publishUpdate();
|
||||||
down();
|
down();
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG("Holding for GPS data download: %d ms", fixHoldEnds - millis());
|
LOG_DEBUG("Holding for GPS data download: %d ms (numSats=%d)", fixHoldEnds - millis(), p.sats_in_view);
|
||||||
}
|
}
|
||||||
shouldPublish = true; // publish our update for this just finished acquisition window
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If state has changed do a publish
|
// If state has changed do a publish
|
||||||
|
Loading…
Reference in New Issue
Block a user