diff --git a/.vscode/launch.json b/.vscode/launch.json index 6c9c892..e2534db 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "request": "launch", "module": "meshtastic", "justMyCode": false, - "args": ["--ble", "--ble-dest", "Meshtastic_9f6e"] + "args": ["--ble", "Meshtastic_9f6e"] }, { "name": "meshtastic BLE scan", diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index e58910a..173d6e0 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1046,7 +1046,7 @@ def common(): print(f"Found: name='{x.name}' address='{x.address}'") meshtastic.util.our_exit("BLE scan finished", 0) elif args.ble: - client = BLEInterface(args.ble_dest, debugOut=logfile, noProto=args.noproto, noNodes=args.no_nodes) + client = BLEInterface(args.ble if args.ble != "any" else None, debugOut=logfile, noProto=args.noproto, noNodes=args.no_nodes) elif args.host: try: client = meshtastic.tcp_interface.TCPInterface( @@ -1114,14 +1114,10 @@ def addConnectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParse group.add_argument( "--ble", - help="The BLE device address or name to connect to", - action="store_true", - ) - - outer.add_argument( - "--ble-dest", - help="The BLE device address or name to connect to", + help="Connect to a BLE device, optionally specifying a device name (defaults to 'any')", + nargs="?", default=None, + const="any" ) return parser