Skip to content

Commit

Permalink
Remove sending of empty JSON to accelerate device setup
Browse files Browse the repository at this point in the history
  • Loading branch information
fleborne committed Dec 12, 2024
1 parent fc8158d commit 74e6aa5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pyluos/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,12 @@ def play(self):
self._pause = False

def _setup(self):
self.logger.info('Sending detection signal.')
self._send({})
time.sleep(0.01)
startTime = time.time()
retry = 0
self.logger.info(f'Sending detection signal ({retry=})')
self._send({'detection': {}})
self.logger.info('Waiting for routing table...')
startTime = time.time()
state = self._poll_once()
retry = 0
while ('routing_table' not in state):
if ('route_table' in state):
self.logger.info("Watch out the Luos revision you are using on your board is too old to work with this revision of pyluos.\n Please consider updating Luos on your boards")
Expand All @@ -162,6 +160,7 @@ def _setup(self):
if retry > 5:
# detection is not working
sys.exit("Detection failed.")
self.logger.info(f'Sending detection signal ({retry=})')
self._send({'detection': {}})
startTime = time.time()
# Save routing table data
Expand Down

0 comments on commit 74e6aa5

Please sign in to comment.