Skip to content

Commit a4830f5

Browse files
committed
Treat a message as an ack if there is an errorReason but it's set to NONE, not just if the errorReason is absent
1 parent 2b1f337 commit a4830f5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

meshtastic/mesh_interface.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ def sendData(
337337
meshPacket.id = self._generatePacketId()
338338

339339
if onResponse is not None:
340+
logging.debug(f"Setting a response handler for requestId {meshPacket.id}")
340341
self._addResponseHandler(meshPacket.id, onResponse)
341342
p = self._sendPacket(meshPacket, destinationId, wantAck=wantAck)
342343
return p
@@ -1034,14 +1035,16 @@ def _handlePacketFromRadio(self, meshPacket, hack=False):
10341035
# Is this message in response to a request, if so, look for a handler
10351036
requestId = decoded.get("requestId")
10361037
if requestId is not None:
1038+
logging.debug(f"Got a response for requestId {requestId}")
10371039
# We ignore ACK packets, but send NAKs and data responses to the handlers
10381040
routing = decoded.get("routing")
1039-
isAck = routing is not None and ("errorReason" not in routing)
1041+
isAck = routing is not None and ("errorReason" not in routing or routing["errorReason"] == "NONE")
10401042
if not isAck:
10411043
# we keep the responseHandler in dict until we get a non ack
10421044
handler = self.responseHandlers.pop(requestId, None)
10431045
if handler is not None:
10441046
if not isAck or (isAck and handler.__name__ == "onAckNak"):
1047+
logging.debug(f"Calling response handler for requestId {requestId}")
10451048
handler.callback(asDict)
10461049

10471050
logging.debug(f"Publishing {topic}: packet={stripnl(asDict)} ")

0 commit comments

Comments
 (0)