@@ -179,8 +179,30 @@ def _onPositionReceive(iface, asDict):
179179 logger .debug (f"p:{ p } " )
180180 p = iface ._fixupPosition (p )
181181 logger .debug (f"after fixup p:{ p } " )
182- # update node DB as needed
183- iface ._getOrCreateByNum (asDict ["from" ])["position" ] = p
182+ # For the local node, only accept position updates with equal
183+ # or better precision. The local GPS is authoritative, and
184+ # low-precision echoes from the mesh (e.g., map reports relayed
185+ # by other nodes) should not overwrite it.
186+ # For remote nodes, always accept the latest position since
187+ # any update from them reflects their current state.
188+ node = iface ._getOrCreateByNum (asDict ["from" ])
189+ is_local_node = (
190+ iface .myInfo is not None
191+ and asDict ["from" ] == iface .myInfo .my_node_num
192+ )
193+ if is_local_node :
194+ existing = node .get ("position" , {})
195+ existing_precision = existing .get ("precisionBits" , 0 ) or 0
196+ new_precision = p .get ("precisionBits" , 0 ) or 0
197+ if existing_precision == 0 or new_precision >= existing_precision :
198+ node ["position" ] = p
199+ else :
200+ logger .debug (
201+ f"Ignoring low-precision position echo for local node "
202+ f"({ new_precision } < { existing_precision } )"
203+ )
204+ else :
205+ node ["position" ] = p
184206
185207
186208def _onNodeInfoReceive (iface , asDict ):
0 commit comments