forked from platformio/platformio-core
Revert back some code linked with uploading to Leonardo/Due
This commit is contained in:
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
VERSION = (2, 9, 2)
|
VERSION = (2, 9, "3.dev0")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -22,6 +22,8 @@ from time import sleep
|
|||||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||||
DefaultEnvironment, SConscript)
|
DefaultEnvironment, SConscript)
|
||||||
|
|
||||||
|
from platformio.util import get_serialports
|
||||||
|
|
||||||
|
|
||||||
def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
||||||
|
|
||||||
@ -63,11 +65,13 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
|||||||
if not upload_options.get("disable_flushing", False):
|
if not upload_options.get("disable_flushing", False):
|
||||||
env.FlushSerialBuffer("$UPLOAD_PORT")
|
env.FlushSerialBuffer("$UPLOAD_PORT")
|
||||||
|
|
||||||
|
before_ports = [i['port'] for i in get_serialports(use_grep=True)]
|
||||||
|
|
||||||
if upload_options.get("use_1200bps_touch", False):
|
if upload_options.get("use_1200bps_touch", False):
|
||||||
env.TouchSerialPort("$UPLOAD_PORT", 1200)
|
env.TouchSerialPort("$UPLOAD_PORT", 1200)
|
||||||
|
|
||||||
if upload_options.get("wait_for_upload_port", False):
|
if upload_options.get("wait_for_upload_port", False):
|
||||||
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort())
|
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports))
|
||||||
|
|
||||||
|
|
||||||
env = DefaultEnvironment()
|
env = DefaultEnvironment()
|
||||||
|
@ -21,6 +21,8 @@ from os.path import basename, join
|
|||||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||||
DefaultEnvironment, SConscript)
|
DefaultEnvironment, SConscript)
|
||||||
|
|
||||||
|
from platformio.util import get_serialports
|
||||||
|
|
||||||
|
|
||||||
def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
||||||
env.AutodetectUploadPort()
|
env.AutodetectUploadPort()
|
||||||
@ -39,11 +41,13 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
|||||||
if not upload_options.get("disable_flushing", False):
|
if not upload_options.get("disable_flushing", False):
|
||||||
env.FlushSerialBuffer("$UPLOAD_PORT")
|
env.FlushSerialBuffer("$UPLOAD_PORT")
|
||||||
|
|
||||||
|
before_ports = [i['port'] for i in get_serialports(use_grep=True)]
|
||||||
|
|
||||||
if upload_options.get("use_1200bps_touch", False):
|
if upload_options.get("use_1200bps_touch", False):
|
||||||
env.TouchSerialPort("$UPLOAD_PORT", 1200)
|
env.TouchSerialPort("$UPLOAD_PORT", 1200)
|
||||||
|
|
||||||
if upload_options.get("wait_for_upload_port", False):
|
if upload_options.get("wait_for_upload_port", False):
|
||||||
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort())
|
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports))
|
||||||
|
|
||||||
# use only port name for BOSSA
|
# use only port name for BOSSA
|
||||||
if "/" in env.subst("$UPLOAD_PORT"):
|
if "/" in env.subst("$UPLOAD_PORT"):
|
||||||
|
@ -47,8 +47,7 @@ def TouchSerialPort(env, port, baudrate):
|
|||||||
sleep(0.4)
|
sleep(0.4)
|
||||||
|
|
||||||
|
|
||||||
def WaitForNewSerialPort(env):
|
def WaitForNewSerialPort(env, before):
|
||||||
before = [i['port'] for i in get_serialports(use_grep=True)]
|
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
new_port = None
|
new_port = None
|
||||||
elapsed = 0
|
elapsed = 0
|
||||||
|
@ -325,7 +325,7 @@ def get_serialports(use_grep=False):
|
|||||||
result.append({"port": p, "description": d, "hwid": h})
|
result.append({"port": p, "description": d, "hwid": h})
|
||||||
|
|
||||||
# fix for PySerial
|
# fix for PySerial
|
||||||
if not result and not use_grep:
|
if not result and not use_grep and system() == "Darwin":
|
||||||
result = _grep_serial_ports()
|
result = _grep_serial_ports()
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
Reference in New Issue
Block a user