From 190ffab76d75ab786da2f328d2f2ff6a93e3a1e6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 3 Jun 2016 01:16:16 +0300 Subject: [PATCH] Hook when new serial port is the same in boot mode --- platformio/builder/tools/pioupload.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index aeb71000..902a162b 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -48,7 +48,6 @@ def TouchSerialPort(env, port, baudrate): def WaitForNewSerialPort(env, before): - sleep(0.5) new_port = None elapsed = 0 while elapsed < 10: @@ -62,6 +61,9 @@ def WaitForNewSerialPort(env, before): sleep(0.25) elapsed += 0.25 + if not new_port and env.subst("$UPLOAD_PORT") in now: + new_port = env.subst("$UPLOAD_PORT") + if not new_port: env.Exit("Error: Couldn't find a board on the selected port. " "Check that you have the correct port selected. "