From cc2c9af221d7825e1c59d1c41e55cac95e2d0167 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Wed, 3 Mar 2021 09:14:48 +0800 Subject: [PATCH] stop fetching channels once we reach disabled --- meshtastic/__init__.py | 8 ++++++-- setup.py | 4 ---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/meshtastic/__init__.py b/meshtastic/__init__.py index 62073aa..c48c56f 100644 --- a/meshtastic/__init__.py +++ b/meshtastic/__init__.py @@ -455,13 +455,17 @@ class MeshInterface: """ p = admin_pb2.AdminMessage() p.get_channel_request = channelNum + 1 + logging.debug(f"Requesting channel {channelNum}") def onResponse(p): """A closure to handle the response packet""" c = p["decoded"]["admin"]["raw"].get_channel_response self.partialChannels.append(c) - if channelNum >= self.myInfo.max_channels - 1: - # Done with all channels + logging.debug(f"Received channel {c}") + # for stress testing, download all channels + # if channelNum >= self.myInfo.max_channels - 1: + if c.role == channel_pb2.Channel.Role.DISABLED or channelNum >= self.myInfo.max_channels - 1: + # Once we see a response that has NO settings, assume we are at the end of channels and stop fetching self.channels = self.partialChannels # FIXME, the following should only be called after we have settings and channels self._connected() # Tell everone else we are ready to go diff --git a/setup.py b/setup.py index 1f9c74d..0307dd5 100644 --- a/setup.py +++ b/setup.py @@ -12,11 +12,7 @@ with open("README.md", "r") as fh: # This call to setup() does all the work setup( name="meshtastic", -<<<<<<< HEAD version="1.2.00", -======= - version="1.1.50", ->>>>>>> dev description="Python API & client shell for talking to Meshtastic devices", long_description=long_description, long_description_content_type="text/markdown",