forked from platformio/platformio-core
Verify that serial port is ready for connection before uploading
This commit is contained in:
@@ -23,7 +23,7 @@ from shutil import copyfile
|
|||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from SCons.Node.Alias import Alias
|
from SCons.Node.Alias import Alias
|
||||||
from serial import Serial
|
from serial import Serial, SerialException
|
||||||
|
|
||||||
from platformio import util
|
from platformio import util
|
||||||
|
|
||||||
@@ -72,6 +72,11 @@ def WaitForNewSerialPort(env, before):
|
|||||||
new_port = p['port']
|
new_port = p['port']
|
||||||
break
|
break
|
||||||
|
|
||||||
|
try:
|
||||||
|
Serial(new_port)
|
||||||
|
except SerialException:
|
||||||
|
sleep(1)
|
||||||
|
|
||||||
if not new_port:
|
if not new_port:
|
||||||
sys.stderr.write("Error: Couldn't find a board on the selected port. "
|
sys.stderr.write("Error: Couldn't find a board on the selected port. "
|
||||||
"Check that you have the correct port selected. "
|
"Check that you have the correct port selected. "
|
||||||
|
Reference in New Issue
Block a user