From 37d12e8810ee67f09135d1c00a23f40419d9c4af Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Fri, 2 Apr 2021 10:17:29 +0800 Subject: [PATCH] fix remote admin timeouts (allow more time and show progress) --- meshtastic/__init__.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/meshtastic/__init__.py b/meshtastic/__init__.py index d7fc76f..4d60a42 100644 --- a/meshtastic/__init__.py +++ b/meshtastic/__init__.py @@ -338,6 +338,11 @@ class Node: logging.debug("Received radio config, now fetching channels...") self._requestChannel(0) # now start fetching channels + # Show progress message for super slow operations + if self != self.iface.localNode: + logging.info( + "Requesting preferences from remote node (this could take a while)") + return self._sendAdmin(p, wantResponse=True, onResponse=onResponse) @@ -388,8 +393,14 @@ class Node: """ p = admin_pb2.AdminMessage() p.get_channel_request = channelNum + 1 - logging.debug(f"Requesting channel {channelNum}") + # Show progress message for super slow operations + if self != self.iface.localNode: + logging.info( + f"Requesting channel {channelNum} info from remote node (this could take a while)") + else: + logging.debug(f"Requesting channel {channelNum}") + def onResponse(p): """A closure to handle the response packet""" c = p["decoded"]["admin"]["raw"].get_channel_response @@ -490,11 +501,9 @@ class MeshInterface: if nodeId == LOCAL_ADDR: return self.localNode else: - logging.info( - "Requesting configuration from remote node (this could take a while)") n = Node(self, nodeId) n.requestConfig() - if not n.waitForConfig(maxsecs=60): + if not n.waitForConfig(maxsecs=120): raise Exception("Timed out waiting for node config") return n