mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-23 19:20:41 +00:00
Throttle GPS initial position warning
This commit is contained in:
@@ -428,8 +428,9 @@ int32_t PositionModule::runOnce()
|
|||||||
bool waitingForFreshPosition = (lastGpsSend == 0) && !config.position.fixed_position && !nodeDB->hasLocalPositionSinceBoot();
|
bool waitingForFreshPosition = (lastGpsSend == 0) && !config.position.fixed_position && !nodeDB->hasLocalPositionSinceBoot();
|
||||||
|
|
||||||
if (lastGpsSend == 0 || msSinceLastSend >= intervalMs) {
|
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");
|
LOG_DEBUG("Skip initial position send; no fresh position since boot");
|
||||||
|
lastWarn = now;
|
||||||
} else if (nodeDB->hasValidPosition(node)) {
|
} else if (nodeDB->hasValidPosition(node)) {
|
||||||
lastGpsSend = now;
|
lastGpsSend = now;
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ class PositionModule : public ProtobufModule<meshtastic_Position>, private concu
|
|||||||
bool hasQualityTimesource();
|
bool hasQualityTimesource();
|
||||||
bool hasGPS();
|
bool hasGPS();
|
||||||
uint32_t lastSentReply = 0; // Last time we sent a position reply (used for reply throttling only)
|
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
|
#if USERPREFS_EVENT_MODE
|
||||||
// In event mode we want to prevent excessive position broadcasts
|
// In event mode we want to prevent excessive position broadcasts
|
||||||
|
|||||||
Reference in New Issue
Block a user