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

19 lines
525 B
Python
Executable File

#!/usr/bin/env python
import serial.tools.list_ports
done = False
for port in serial.tools.list_ports.comports():
if "483:5740" in port[2]:
print ("Reseting stmbl at " + port[2])
try:
stmbl = serial.Serial(port[0])
stmbl.write('bootloader\n'.encode())
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")