From 802768e0cc77a380b9e0050c08814b56596b1eb2 Mon Sep 17 00:00:00 2001 From: GUVWAF Date: Sat, 18 Mar 2023 16:40:27 +0100 Subject: [PATCH] Nicer printing --- meshtastic/__main__.py | 3 ++- meshtastic/node.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 5e6c510..c9b9be8 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -65,6 +65,7 @@ def getPref(interface, dest, comp_name): logging.debug(f'snake_name:{snake_name} camel_name:{camel_name}') logging.debug(f'use camel:{Globals.getInstance().get_camel_case()}') + # First validate the input by looking at config of connected node localConfig = interface.getNode(BROADCAST_ADDR).localConfig moduleConfig = interface.getNode(BROADCAST_ADDR).moduleConfig found = False @@ -103,7 +104,7 @@ def getPref(interface, dest, comp_name): print(f"{str(config_type.name)}: {str(config_values)}") logging.debug(f"{str(config_type.name)}: {str(config_values)}") else: - # Always request full config for remote node + # Always show full config for remote node interface.getNode(dest, False).requestConfig(config_type) return True diff --git a/meshtastic/node.py b/meshtastic/node.py index d3f328a..563a245 100644 --- a/meshtastic/node.py +++ b/meshtastic/node.py @@ -78,10 +78,13 @@ class Node: self.iface._acknowledgment.receivedNak = True else: self.iface._acknowledgment.receivedAck = True + print("") if "getConfigResponse" in p["decoded"]["admin"]: - print("Config is as follows:", p["decoded"]["admin"]['getConfigResponse']) + prefs = stripnl(p["decoded"]["admin"]["getConfigResponse"]) + print(f"Preferences: {prefs}\n") else: - print("Module Config is as follows:", p["decoded"]["admin"]['getModuleConfigResponse']) + prefs = stripnl(p["decoded"]["admin"]["getModuleConfigResponse"]) + print(f"Module preferences: {prefs}\n") def requestConfig(self, configType): print("Requesting config from remote node (this can take a while).")