fix: restore fixed position into localPosition on boot#10670
Open
cvaldess wants to merge 8 commits into
Open
Conversation
Fixed-position nodes without a GPS stop broadcasting their position (and publishing MQTT map reports) after a reboot. On boot localPosition is empty, and NodeDB::hasValidPosition() for the local node only inspects localPosition, not the persisted node position. PositionModule therefore never sends a position, so the lazy localPosition backfill in getPositionPacket() never runs and localPosition stays at (0,0) indefinitely. Restore the configured fixed position into localPosition during NodeDB construction so position broadcasts and map reports resume automatically after a reboot.
ab7eb3f to
6c9a6f1
Compare
…d-position-on-boot
…d-position-on-boot
…d-position-on-boot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixed-position nodes without a GPS stop broadcasting their position — and stop publishing MQTT map reports — after a reboot. The persisted fixed position is still in the NodeDB (it shows up in
--info), but the node never sends a position again until a position is manually re-set during the same session.Root cause
On boot
localPosition(RAM) starts empty and nothing repopulates it from the persisted fixed position.NodeDB::hasValidPosition()for the local node only inspectslocalPosition, not the stored node position:So
PositionModule::runOnce()never reachessendOurPosition()(itshasValidPosition(node)gate is false), the lazylocalPositionbackfill insidegetPositionPacket()never runs, andlocalPositionstays(0, 0)indefinitely. The deadlock is normally broken only by a live GPS fix or by an admin position set in the same session — neither of which happens on a headless fixed-position node after a reboot.Fix
During
NodeDBconstruction, whenconfig.position.fixed_positionis set, restore the persisted node position intolocalPosition. Position broadcasts and MQTT map reports then resume automatically after a reboot, with no manual intervention.Validation
Reproduced and verified on RP2350 + W5500 boards (fixed position, no GPS):
MQTT Map report enabled, but no position availableafter every reboot, and noMAP_REPORT_APPreaching the broker.localPositionis restored at boot (Restored fixed position to localPosition: ...), position broadcasts resume, and the map report publishes tomsh/<region>/2/map/on each reboot.