From 6c9a6f1e969e1c559cd5bf882f0921f68f0c6414 Mon Sep 17 00:00:00 2001 From: CValdesS Date: Wed, 10 Jun 2026 01:17:07 +0200 Subject: [PATCH] NodeDB: restore fixed position into localPosition at boot 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. --- src/mesh/NodeDB.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index b047a14a654..9701a7307c7 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -576,6 +576,19 @@ NodeDB::NodeDB() moduleConfig.mqtt.map_report_settings.publish_interval_secs = default_map_publish_interval_secs; } + // Restore a configured fixed position into localPosition at boot. Without this, fixed-position + // nodes that have no GPS never repopulate localPosition after a reboot: hasValidPosition() for the + // local node only inspects localPosition, so the position broadcast (and its lazy localPosition + // backfill in PositionModule) never runs, and position broadcasts / MQTT map reports silently stop + // until a position is manually re-sent. + if (config.position.fixed_position) { + meshtastic_PositionLite fixedPos; + if (copyNodePosition(getNodeNum(), fixedPos) && (fixedPos.latitude_i != 0 || fixedPos.longitude_i != 0)) { + setLocalPosition(TypeConversions::ConvertToPosition(fixedPos)); + LOG_INFO("Restored fixed position to localPosition: lat=%d lon=%d", fixedPos.latitude_i, fixedPos.longitude_i); + } + } + // Ensure that the neighbor info update interval is coerced to the minimum moduleConfig.neighbor_info.update_interval = Default::getConfiguredOrMinimumValue(moduleConfig.neighbor_info.update_interval, min_neighbor_info_broadcast_secs);