px_uploader.py: fix exception on baudrate change

This prevents an exception happening inside the serial stack.
This commit is contained in:
Julian Oes 2017-04-20 14:20:56 +02:00 committed by Lorenz Meier
parent 0754e8f8bc
commit 2467297acf
1 changed files with 6 additions and 1 deletions

View File

@ -546,7 +546,12 @@ class uploader(object):
if self.baudrate_flightstack_idx >= len(self.baudrate_flightstack):
return False
self.port.baudrate = self.baudrate_flightstack[self.baudrate_flightstack_idx]
try:
self.port.baudrate = self.baudrate_flightstack[self.baudrate_flightstack_idx]
except serial.SerialException:
# Sometimes _configure_port fails
time.sleep(0.04)
pass
return True