Nicer printing

This commit is contained in:
GUVWAF
2023-03-18 16:40:27 +01:00
parent f68e4112e1
commit 802768e0cc
2 changed files with 7 additions and 3 deletions

View File

@@ -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

View File

@@ -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).")