From 680c3867db4a0fd1e79da773238c9841945a2571 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 30 Dec 2015 15:02:13 +0200 Subject: [PATCH] Allow to use DNS.local as upload port for OTA // Issue #382 --- docs/platforms/espressif_extra.rst | 14 +++++++++----- platformio/__init__.py | 2 +- platformio/builder/scripts/espressif.py | 4 +++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/platforms/espressif_extra.rst b/docs/platforms/espressif_extra.rst index 8a9f0f3d..ae92131d 100644 --- a/docs/platforms/espressif_extra.rst +++ b/docs/platforms/espressif_extra.rst @@ -66,9 +66,8 @@ Uploading files to file system SPIFFS 2. Run target ``uploadfs`` via :option:`platformio run --target` command. To upload SPIFFS image using OTA update please specify ``upload_port`` / -``--upload-port`` as IP address. For the details please follow to -:ref:`platform_espressif_ota`. For example, ``platformio run -t uploadfs ---upload_port 192.168.0.255``. +``--upload-port`` as IP address or DNS name (``*.local``). For the details +please follow to :ref:`platform_espressif_ota`. By default, will be used default LD Script for the board where is specified SPIFFS offsets (start, end, page, block). You can override it using @@ -89,7 +88,7 @@ There are 2 options: .. code-block:: bash - platformio run --target upload --upload-port IP_ADDRESS_HERE + platformio run --target upload --upload-port IP_ADDRESS_HERE or DNS_NAME.local * Specify ``upload_port`` option in :ref:`projectconf` @@ -97,7 +96,12 @@ There are 2 options: [env:myenv] ... - upload_port = IP_ADDRESS_HERE + upload_port = IP_ADDRESS_HERE or DNS_NAME.local + +For example, + +* ``platformio run -t upload --upload-port 192.168.0.255`` +* ``platformio run -t upload --upload-port myesp8266.local`` Authentication and upload options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index c84d4362..ebcb7a28 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (2, 7, "0.dev10") +VERSION = (2, 7, "0.dev11") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/builder/scripts/espressif.py b/platformio/builder/scripts/espressif.py index c1dd7d35..ec233db1 100644 --- a/platformio/builder/scripts/espressif.py +++ b/platformio/builder/scripts/espressif.py @@ -231,7 +231,9 @@ if "FRAMEWORK" in env: # Handle uploading via OTA try: - if env.get("UPLOAD_PORT") and socket.inet_aton(env.get("UPLOAD_PORT")): + if (env.get("UPLOAD_PORT") and ( + env.get("UPLOAD_PORT").endswith(".local") or + socket.inet_aton(env.get("UPLOAD_PORT")))): env.Replace( UPLOADCMD="$UPLOADOTACMD" )