Windows specific serial port open bug fixed.

This commit is contained in:
klaute 2016-09-25 10:57:24 +02:00
parent a2e59d7a61
commit 76cc8a2828

View file

@ -285,9 +285,10 @@ def openSerialDevice(d):
global ser
try:
ser = serial.Serial(d)
#serial.Serial.close()
ser = serial.Serial("\\\\.\\"+d)
except:
print "ERROR: Can't open the serial device " + device
print "ERROR (1): Can't open the serial device " + d
exit(1)
# Toggle DTR to reset Arduino
@ -299,8 +300,9 @@ def openSerialDevice(d):
ser.setDTR(True)
try:
ser.close()
ser = serial.Serial(
port=d,\
port="\\\\.\\"+d,\
baudrate=115200,\
parity=serial.PARITY_NONE,\
stopbits=serial.STOPBITS_ONE,\
@ -308,7 +310,7 @@ def openSerialDevice(d):
rtscts=0,\
timeout=0)
except:
print "ERROR: Can't open the serial device " + device
print "ERROR (2): Can't open the serial device " + d
exit(2)
#####