1
0
mirror of https://github.com/rene-dev/stmbl.git synced 2024-12-20 23:52:15 +00:00
stmbl/tools/bootloader.py

19 lines
525 B
Python
Raw Permalink Normal View History

2018-04-07 00:00:04 +00:00
#!/usr/bin/env python
2016-08-12 15:12:16 +00:00
import serial.tools.list_ports
done = False
for port in serial.tools.list_ports.comports():
2016-08-26 10:13:33 +00:00
if "483:5740" in port[2]:
2017-09-08 10:51:39 +00:00
print ("Reseting stmbl at " + port[2])
try:
stmbl = serial.Serial(port[0])
2018-04-07 00:00:04 +00:00
stmbl.write('bootloader\n'.encode())
stmbl.close()
done = True
except OSError:
print ("Cannot open port, check permissions, or disconnect Servoterm")
done = True
2016-08-12 15:12:16 +00:00
if not done:
2017-09-10 11:59:15 +00:00
print ("No boards found, or board is already in bootloader")