From c3d044e3f2bc93b30397d428f95d554a4532ee77 Mon Sep 17 00:00:00 2001 From: Todd Herbert Date: Fri, 24 May 2024 17:10:07 +1200 Subject: [PATCH] Optional pause before disconnecting --- meshtastic/__main__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 4474966..ca0b73f 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -861,6 +861,10 @@ def onConnected(interface): ) interface.getNode(args.dest, False).iface.waitForAckNak() + if args.wait_to_disconnect: + print(f"Waiting {args.wait_to_disconnect} seconds before disconnecting" ) + time.sleep(int(args.wait_to_disconnect)) + # if the user didn't ask for serial debugging output, we might want to exit after we've done our operation if (not args.seriallog) and closeNow: interface.close() # after running command then exit @@ -1473,6 +1477,14 @@ def initParser(): action="store_true", ) + group.add_argument( + "--wait-to-disconnect", + help="How many seconds to wait before disconnecting from the device.", + const="5", + nargs="?", + action="store", + ) + group.add_argument( "--noproto", help="Don't start the API, just function as a dumb serial terminal.",