mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
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.
This commit is contained in:
parent
2467297acf
commit
e9aef2eb95
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user