From 8350cc611dd453dfbad1bfa04cf01de223a92c15 Mon Sep 17 00:00:00 2001 From: GUVWAF Date: Sat, 8 Oct 2022 12:47:13 +0200 Subject: [PATCH] Catch RoutingApp on requestChannel --- meshtastic/node.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/meshtastic/node.py b/meshtastic/node.py index ba06eb0..79f0a6e 100644 --- a/meshtastic/node.py +++ b/meshtastic/node.py @@ -525,6 +525,20 @@ class Node: def onResponseRequestChannel(self, p): """Handle the response packet for requesting a channel _requestChannel()""" logging.debug(f'onResponseRequestChannel() p:{p}') + + if p["decoded"]["portnum"] == portnums_pb2.PortNum.Name(portnums_pb2.PortNum.ROUTING_APP): + print('No admin, error reason: ', p["decoded"]["routing"]["errorReason"]) + if p["decoded"]["routing"]["errorReason"] != "NONE": + logging.warning(f'Channel request failed, error reason: {p["decoded"]["routing"]["errorReason"]}') + self._timeout.expireTime = time.time() # Do not wait any longer + return # Don't try to parse this routing message + lastTried = 0 + if len(self.partialChannels) > 0: + lastTried = self.partialChannels[-1] + logging.debug(f"Retrying previous channel request.") + self._requestChannel(lastTried) + return + c = p["decoded"]["admin"]["raw"].get_channel_response self.partialChannels.append(c) self._timeout.reset() # We made foreward progress