Skip to content

fix: restore fixed position into localPosition on boot#10670

Open
cvaldess wants to merge 8 commits into
meshtastic:developfrom
cvaldess:fix/restore-fixed-position-on-boot
Open

fix: restore fixed position into localPosition on boot#10670
cvaldess wants to merge 8 commits into
meshtastic:developfrom
cvaldess:fix/restore-fixed-position-on-boot

Conversation

@cvaldess

Copy link
Copy Markdown
Contributor

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 inspects localPosition, not the stored node position:

if (n->num == getNodeNum()) {
    return localPosition.latitude_i != 0 || localPosition.longitude_i != 0;
}

So PositionModule::runOnce() never reaches sendOurPosition() (its hasValidPosition(node) gate is false), the lazy localPosition backfill inside getPositionPacket() never runs, and localPosition stays (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 NodeDB construction, when config.position.fixed_position is set, restore the persisted node position into localPosition. 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):

  • Before: MQTT Map report enabled, but no position available after every reboot, and no MAP_REPORT_APP reaching the broker.
  • After: localPosition is restored at boot (Restored fixed position to localPosition: ...), position broadcasts resume, and the map report publishes to msh/<region>/2/map/ on each reboot.

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.
@cvaldess cvaldess force-pushed the fix/restore-fixed-position-on-boot branch from ab7eb3f to 6c9a6f1 Compare June 10, 2026 00:49
@github-actions github-actions Bot added the bugfix Pull request that fixes bugs label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant