From 2b42439fd09db378a6944936100b0f633136888f Mon Sep 17 00:00:00 2001 From: geeksville Date: Tue, 28 Apr 2020 10:22:12 -0700 Subject: [PATCH] show debug output as json --- bin/run.sh | 2 +- meshtastic/interface.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/run.sh b/bin/run.sh index db8afb5..e6c25e0 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -1 +1 @@ -python3 -m meshtastic --debug "$@" +python3 -m meshtastic "$@" diff --git a/meshtastic/interface.py b/meshtastic/interface.py index 0eae726..00ef54e 100644 --- a/meshtastic/interface.py +++ b/meshtastic/interface.py @@ -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"):