mirror of
https://github.com/meshtastic/python.git
synced 2026-04-20 23:11:45 -04:00
feat:506 show all module settings
Problem:
Missing fields are omitted.
Solution:
This fix sets the flag `always_print_fields_with_no_presence`
in the invocation of the protobuff method
`MessageToJson` will display the missing fields.
see: MessageToJson 6b36eb633c/python/google/protobuf/json_format.py (L82)
see: issue #506 https://github.com/meshtastic/python/issues/506
This commit is contained in:
@@ -15,6 +15,7 @@ from meshtastic.util import (
|
||||
our_exit,
|
||||
pskToString,
|
||||
stripnl,
|
||||
message_to_json,
|
||||
)
|
||||
|
||||
|
||||
@@ -47,8 +48,7 @@ class Node:
|
||||
if self.channels:
|
||||
logging.debug(f"self.channels:{self.channels}")
|
||||
for c in self.channels:
|
||||
# print('c.settings.psk:', c.settings.psk)
|
||||
cStr = stripnl(MessageToJson(c.settings))
|
||||
cStr = message_to_json(c.settings)
|
||||
# don't show disabled channels
|
||||
if channel_pb2.Channel.Role.Name(c.role) != "DISABLED":
|
||||
print(
|
||||
@@ -64,11 +64,11 @@ class Node:
|
||||
"""Show human readable description of our node"""
|
||||
prefs = ""
|
||||
if self.localConfig:
|
||||
prefs = stripnl(MessageToJson(self.localConfig))
|
||||
prefs = message_to_json(self.localConfig)
|
||||
print(f"Preferences: {prefs}\n")
|
||||
prefs = ""
|
||||
if self.moduleConfig:
|
||||
prefs = stripnl(MessageToJson(self.moduleConfig))
|
||||
prefs = message_to_json(self.moduleConfig)
|
||||
print(f"Module preferences: {prefs}\n")
|
||||
self.showChannels()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user