diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 3cc503f..8f190cb 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -804,10 +804,14 @@ def onConnected(interface): return interface.showNodes() - if args.qr: + if args.qr or args.qr_all: closeNow = True - url = interface.localNode.getURL(includeAll=False) - print(f"Primary channel URL {url}") + url = interface.getNode(args.dest, True).getURL(includeAll=args.qr_all) + if args.qr_all: + urldesc = "Complete URL (includes all channels)" + else: + urldesc = "Primary channel URL" + print(f"{urldesc}: {url}") qr = pyqrcode.create(url) print(qr.terminal()) @@ -1157,7 +1161,16 @@ def initParser(): group.add_argument( "--qr", - help="Display the QR code that corresponds to the current channel", + help=( + "Display a QR code for the node's primary channel (or all channels with --qr-all). " + "Also shows the shareable channel URL." + ), + action="store_true", + ) + + group.add_argument( + "--qr-all", + help="Display a QR code and URL for all of the node's channels.", action="store_true", ) diff --git a/meshtastic/node.py b/meshtastic/node.py index 02f726a..0f6fb99 100644 --- a/meshtastic/node.py +++ b/meshtastic/node.py @@ -313,6 +313,8 @@ class Node: ): channelSet.settings.append(c.settings) + if len(self.localConfig.ListFields()) == 0: + self.requestConfig(self.localConfig.DESCRIPTOR.fields_by_name.get('lora')) channelSet.lora_config.CopyFrom(self.localConfig.lora) some_bytes = channelSet.SerializeToString() s = base64.urlsafe_b64encode(some_bytes).decode("ascii")