mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 05:23:33 +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:
@@ -542,16 +542,14 @@ class uploader(object):
|
|||||||
self.port.close()
|
self.port.close()
|
||||||
|
|
||||||
def __next_baud_flightstack(self):
|
def __next_baud_flightstack(self):
|
||||||
self.baudrate_flightstack_idx = self.baudrate_flightstack_idx + 1
|
if self.baudrate_flightstack_idx + 1 >= len(self.baudrate_flightstack):
|
||||||
if self.baudrate_flightstack_idx >= len(self.baudrate_flightstack):
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
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:
|
except serial.SerialException:
|
||||||
# Sometimes _configure_port fails
|
# Sometimes _configure_port fails
|
||||||
time.sleep(0.04)
|
time.sleep(0.04)
|
||||||
pass
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user