mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-20 03:13:44 +08:00
Better error handling for multi-board setups
This commit is contained in:
@@ -416,7 +416,7 @@ class uploader(object):
|
||||
def upload(self, fw):
|
||||
# Make sure we are doing the right thing
|
||||
if self.board_type != fw.property('board_id'):
|
||||
raise RuntimeError("Firmware not suitable for this board")
|
||||
raise IOError("Firmware not suitable for this board")
|
||||
if self.fw_maxsize < fw.property('image_size'):
|
||||
raise RuntimeError("Firmware image is too large for this board")
|
||||
|
||||
@@ -564,13 +564,12 @@ try:
|
||||
up.upload(fw)
|
||||
|
||||
except RuntimeError as ex:
|
||||
# print the error
|
||||
print("\nERROR: %s" % ex.args)
|
||||
|
||||
if "not suitable" in ex.args:
|
||||
up.close()
|
||||
continue
|
||||
else:
|
||||
# print the error
|
||||
print("\nERROR: %s" % ex.args)
|
||||
except IOError as e:
|
||||
up.close();
|
||||
continue
|
||||
|
||||
finally:
|
||||
# always close the port
|
||||
|
||||
Reference in New Issue
Block a user