Throttle GPS initial position warning

This commit is contained in:
Jonathan Bennett
2025-12-21 21:59:29 -06:00
parent 5a3855b208
commit 954e600448
2 changed files with 3 additions and 1 deletions

View File

@@ -428,8 +428,9 @@ int32_t PositionModule::runOnce()
bool waitingForFreshPosition = (lastGpsSend == 0) && !config.position.fixed_position && !nodeDB->hasLocalPositionSinceBoot();
if (lastGpsSend == 0 || msSinceLastSend >= intervalMs) {
if (waitingForFreshPosition) {
if (waitingForFreshPosition && !Throttle::isWithinTimespanMs(lastWarn, ONE_MINUTE_MS)) {
LOG_DEBUG("Skip initial position send; no fresh position since boot");
lastWarn = now;
} else if (nodeDB->hasValidPosition(node)) {
lastGpsSend = now;

View File

@@ -64,6 +64,7 @@ class PositionModule : public ProtobufModule<meshtastic_Position>, private concu
bool hasQualityTimesource();
bool hasGPS();
uint32_t lastSentReply = 0; // Last time we sent a position reply (used for reply throttling only)
uint32_t lastWarn = 0; // for throttling initial position warning
#if USERPREFS_EVENT_MODE
// In event mode we want to prevent excessive position broadcasts