Skip to content
Snippets Groups Projects
Commit e9aef2eb authored by Julian Oes's avatar Julian Oes Committed by Lorenz Meier
Browse files

px_uploader.py: properly loop through all baudrates

In case when the baudrate change failed, we should still try that
baudrate again in the next iteration.
parent 2467297a
No related branches found
No related tags found
No related merge requests found
......@@ -542,16 +542,14 @@ class uploader(object):
self.port.close()
def __next_baud_flightstack(self):
self.baudrate_flightstack_idx = self.baudrate_flightstack_idx + 1
if self.baudrate_flightstack_idx >= len(self.baudrate_flightstack):
if self.baudrate_flightstack_idx + 1 >= len(self.baudrate_flightstack):
return False
try:
self.port.baudrate = self.baudrate_flightstack[self.baudrate_flightstack_idx]
self.port.baudrate = self.baudrate_flightstack[self.baudrate_flightstack_idx + 1]
self.baudrate_flightstack_idx = self.baudrate_flightstack_idx + 1
except serial.SerialException:
# Sometimes _configure_port fails
time.sleep(0.04)
pass
return True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment