properly ignore messages we sent

This commit is contained in:
Kevin Hester
2021-03-05 10:18:49 +08:00
parent 6bb7766861
commit 3187874c48

View File

@@ -521,7 +521,7 @@ class MeshInterface:
asDict = google.protobuf.json_format.MessageToDict(fromRadio)
if fromRadio.HasField("my_info"):
self.myInfo = fromRadio.my_info
logging.debug(f"Received myinfo: {fromRadio.my_info}")
logging.debug(f"Received myinfo: {stripnl(fromRadio.my_info)}")
failmsg = None
# Check for app too old
@@ -622,6 +622,14 @@ class MeshInterface:
# want the raw protobuf, so we provide it in "raw"
asDict["raw"] = meshPacket
# from might be missing if the nodenum was zero.
if not "from" in asDict:
asDict["from"] = 0
logging.error(f"Device returned a packet we sent, ignoring: {stripnl(asDict)}")
return
if not "to" in asDict:
asDict["to"] = 0
# /add fromId and toId fields based on the node ID
asDict["fromId"] = self._nodeNumToId(asDict["from"])
asDict["toId"] = self._nodeNumToId(asDict["to"])