stop fetching channels once we reach disabled

This commit is contained in:
Kevin Hester
2021-03-03 09:14:48 +08:00
parent 257620e992
commit cc2c9af221
2 changed files with 6 additions and 6 deletions

View File

@@ -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

View File

@@ -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",