show debug output as json

This commit is contained in:
geeksville
2020-04-28 10:22:12 -07:00
parent 1b8df614bf
commit 2b42439fd0
2 changed files with 4 additions and 2 deletions

View File

@@ -1 +1 @@
python3 -m meshtastic --debug "$@"
python3 -m meshtastic "$@"

View File

@@ -1,4 +1,5 @@
import google.protobuf.json_format
import serial
import serial.tools.list_ports
import threading
@@ -97,7 +98,8 @@ class MeshInterface:
Called by subclasses."""
fromRadio = mesh_pb2.FromRadio()
fromRadio.ParseFromString(fromRadioBytes)
logging.debug(f"Received: {fromRadio}")
json = google.protobuf.json_format.MessageToJson(fromRadio)
logging.debug(f"Received: {json}")
if fromRadio.HasField("my_info"):
self.myInfo = fromRadio.my_info
if fromRadio.HasField("radio"):