mirror of
https://github.com/meshtastic/python.git
synced 2026-01-07 07:17:56 -05:00
auto decode text payloads
This commit is contained in:
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@@ -27,6 +27,14 @@
|
||||
"module": "meshtastic",
|
||||
"justMyCode": true,
|
||||
"args": ["--debug", "--seriallog", "stdout"]
|
||||
},
|
||||
{
|
||||
"name": "meshtastic test",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"module": "meshtastic",
|
||||
"justMyCode": true,
|
||||
"args": ["--test"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -249,9 +249,9 @@ class MeshInterface:
|
||||
if meshPacket.decoded.HasField("data"):
|
||||
topic = "meshtastic.receive.data"
|
||||
# For text messages, we go ahead and decode the text to ascii for our users
|
||||
# if asObj.decoded.data.typ == "CLEAR_TEXT":
|
||||
# asObj.decoded.data.text = asObj.decoded.data.decoded.decode(
|
||||
# "utf-8")
|
||||
if asDict["decoded"]["data"]["typ"] == "CLEAR_TEXT":
|
||||
asDict["decoded"]["data"]["text"] = meshPacket.decoded.data.payload.decode(
|
||||
"utf-8")
|
||||
|
||||
pub.sendMessage(topic, packet=asDict, interface=self)
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ def testSend(fromInterface, toInterface):
|
||||
toNode = toInterface.myInfo.my_node_num
|
||||
|
||||
# FIXME, hack to test broadcast
|
||||
toNode = 255
|
||||
# toNode = 255
|
||||
|
||||
logging.info(f"Sending test packet from {fromNode} to {toNode}")
|
||||
fromInterface.sendText(f"Test {testNumber}", toNode)
|
||||
|
||||
Reference in New Issue
Block a user