Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sending of empty JSON to accelerate device setup #203

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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