From 6506a1be1a115cbaf08cdc2700f5127261094ae7 Mon Sep 17 00:00:00 2001 From: GUVWAF Date: Mon, 10 Apr 2023 11:26:50 +0200 Subject: [PATCH] Option to wait for ACK after --sendtext --- meshtastic/__main__.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 35d5d3a..a18b408 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -383,7 +383,11 @@ def onConnected(interface): f"Sending text message {args.sendtext} to {args.dest} on channelIndex:{channelIndex}" ) interface.sendText( - args.sendtext, args.dest, wantAck=True, channelIndex=channelIndex + args.sendtext, + args.dest, + wantAck=True, + channelIndex=channelIndex, + onResponse=interface.getNode(args.dest, False).onAckNak, ) else: meshtastic.util.our_exit( @@ -762,7 +766,7 @@ def onConnected(interface): else: tunnel.Tunnel(interface, subnet=args.tunnel_net) - if args.dest != BROADCAST_ADDR and waitForAckNak: + if args.ack or (args.dest != BROADCAST_ADDR and waitForAckNak): print( f"Waiting for an acknowledgment from remote node (this could take a while)" ) @@ -1183,6 +1187,12 @@ def initParser(): "Only nodes that have the encryption key can be traced.", ) + parser.add_argument( + "--ack", + help="Use in combination with --sendtext to wait for an acknowledgment.", + action="store_true", + ) + parser.add_argument( "--reboot", help="Tell the destination node to reboot", action="store_true" )