Skip to content

Commit

Permalink
format output
Browse files Browse the repository at this point in the history
  • Loading branch information
pdxlocations committed Aug 4, 2024
1 parent d996965 commit 577f376
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions meshtastic/mesh_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ def _handlePacketFromRadio(self, meshPacket, hack=False):
# We normally decompose the payload into a dictionary so that the client
# doesn't need to understand protobufs. But advanced clients might
# want the raw protobuf, so we provide it in "raw"
asDict["raw"] = meshPacket
asDict["raw"] = stripnl(meshPacket)

# from might be missing if the nodenum was zero.
if not hack and "from" not in asDict:
Expand Down Expand Up @@ -1201,7 +1201,7 @@ def _handlePacketFromRadio(self, meshPacket, hack=False):
p = google.protobuf.json_format.MessageToDict(pb)
asDict["decoded"][handler.name] = p
# Also provide the protobuf raw
asDict["decoded"][handler.name]["raw"] = pb
asDict["decoded"][handler.name]["raw"] = stripnl(pb)

Check warning on line 1204 in meshtastic/mesh_interface.py

View check run for this annotation

Codecov / codecov/patch

meshtastic/mesh_interface.py#L1204

Added line #L1204 was not covered by tests

# Call specialized onReceive if necessary
if handler.onReceive is not None:
Expand All @@ -1225,6 +1225,7 @@ def _handlePacketFromRadio(self, meshPacket, hack=False):
handler.callback(asDict)

logging.debug(f"Publishing {topic}: packet={stripnl(asDict)} ")
asDictJson = json.dumps(asDict, indent=2, default=str)
publishingThread.queueWork(
lambda: pub.sendMessage(topic, packet=asDict, interface=self)
lambda: pub.sendMessage(topic, packet=asDictJson, interface=self)
)

0 comments on commit 577f376

Please sign in to comment.