1
0
mirror of https://github.com/rene-dev/stmbl.git synced 2024-12-24 09:32:10 +00:00

better error handling in bootloader script

This commit is contained in:
Rene Hopf 2017-12-06 18:33:16 +01:00
parent 4a1ea05fa4
commit cdebad1738

View File

@ -13,10 +13,14 @@ done = False
for port in serial.tools.list_ports.comports():
if "483:5740" in port[2]:
print ("Reseting stmbl at " + port[2])
stmbl = serial.Serial(port[0])
stmbl.write('bootloader\n')
stmbl.close()
done = True
try:
stmbl = serial.Serial(port[0])
stmbl.write('bootloader\n')
stmbl.close()
done = True
except OSError:
print ("Cannot open port, check permissions, or disconnect Servoterm")
done = True
if not done:
print ("No boards found, or board is already in bootloader")