Skip to content

Commit 948846e

Browse files
committed
Send the position the node already thinks it's at when --no-time is absent, rather than an empty position
1 parent 6c4dbb6 commit 948846e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

meshtastic/__main__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,12 @@ def onConnected(interface):
277277
interface.localNode.writeConfig("position")
278278
elif not args.no_time:
279279
# We normally provide a current time to the mesh when we connect
280-
interface.sendPosition()
280+
if interface.localNode.nodeNum in interface.nodesByNum and "position" in interface.nodesByNum[interface.localNode.nodeNum]:
281+
# send the same position the node already knows, just to update time
282+
position = interface.nodesByNum[interface.localNode.nodeNum]["position"]
283+
interface.sendPosition(position.get("latitude", 0.0), position.get("longitude", 0.0), position.get("altitude", 0.0))
284+
else:
285+
interface.sendPosition()
281286

282287
if args.set_owner:
283288
closeNow = True

0 commit comments

Comments
 (0)