Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/mesh/NodeDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,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);
Expand Down