clean up position broadcasts, send them even if we don't have gps lock

This commit is contained in:
Kevin Hester
2021-02-14 11:57:48 +08:00
parent 52ec4d511c
commit a872231f8a
3 changed files with 31 additions and 19 deletions

View File

@@ -247,22 +247,5 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *unused)
// Update our current position in the local DB
nodeDB.updatePosition(nodeDB.getNodeNum(), pos);
// We limit our GPS broadcasts to a max rate
static uint32_t lastGpsSend;
uint32_t now = millis();
if (lastGpsSend == 0 || now - lastGpsSend > getPref_position_broadcast_secs() * 1000) {
lastGpsSend = now;
static uint32_t currentGeneration;
// If we changed channels, ask everyone else for their latest info
bool requestReplies = currentGeneration != radioGeneration;
currentGeneration = radioGeneration;
DEBUG_MSG("Sending position to mesh (wantReplies=%d)\n", requestReplies);
assert(positionPlugin);
positionPlugin->sendOurPosition(NODENUM_BROADCAST, requestReplies);
}
return 0;
}