From ab5b53703cfbf093f32a4c11c98bf6beab1992f3 Mon Sep 17 00:00:00 2001 From: arendst Date: Sat, 30 Sep 2017 15:49:31 +0200 Subject: [PATCH] Revert "Add optional pio OTA upload" This reverts commit 615a398b17c98aa5965f61e0c43e351bbd86084f. --- pio/espupload.py | 105 ------------------------------------------- pio/http-uploader.py | 12 ----- pio/sftp-uploader.py | 6 --- platformio.ini | 54 +++------------------- 4 files changed, 5 insertions(+), 172 deletions(-) delete mode 100644 pio/espupload.py delete mode 100644 pio/http-uploader.py delete mode 100644 pio/sftp-uploader.py diff --git a/pio/espupload.py b/pio/espupload.py deleted file mode 100644 index 9d495413c..000000000 --- a/pio/espupload.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/python -# -# espupload by Theo Arends - 20170103 -# -# Uploads binary file to OTA server -# -# Execute: espupload -i -p -f -# Execute: espupload -u / -f -# -# Needs pycurl -# - pip install pycurl - -import sys -import os -import optparse -import logging -import pycurl - -HOST_URL = "domus1:80/api/upload-arduino.php" - -def upload(hostUrl, filename): - url = 'http://%s' % (hostUrl) - c = pycurl.Curl() - c.setopt(c.URL, url) - # The "Expect:" is there to suppress "Expect: 100-continue" behaviour that is - # the default in libcurl when posting large bodies (and fails on lighttpd). - c.setopt(c.HTTPHEADER, ["Expect:"]) - c.setopt(c.HTTPPOST, [('file', (c.FORM_FILE, filename, )), ]) - c.perform() - c.close() - -def parser(): - parser = optparse.OptionParser( - usage = "%prog [options]", - description = "Upload image to over the air Host server for the esp8266 module with OTA support." - ) - - # destination ip and port - group = optparse.OptionGroup(parser, "Destination") - group.add_option("-u", "--host_url", - dest = "host_url", - action = "store", - help = "Host url", - default = HOST_URL - ) - parser.add_option_group(group) - - # image - group = optparse.OptionGroup(parser, "Image") - group.add_option("-f", "--file", - dest = "image", - help = "Image file.", - metavar = "FILE", - default = None - ) - parser.add_option_group(group) - - # output group - group = optparse.OptionGroup(parser, "Output") - group.add_option("-d", "--debug", - dest = "debug", - help = "Show debug output. And override loglevel with debug.", - action = "store_true", - default = False - ) - parser.add_option_group(group) - - (options, args) = parser.parse_args() - - return options -# end parser - -def main(args): - # get options - options = parser() - - # adapt log level - loglevel = logging.WARNING - if (options.debug): - loglevel = logging.DEBUG - # end if - - # logging - logging.basicConfig(level = loglevel, format = '%(asctime)-8s [%(levelname)s]: %(message)s', datefmt = '%H:%M:%S') - - logging.debug("Options: %s", str(options)) - - if (not options.host_url or not options.image): - logging.critical("Not enough arguments.") - - return 1 - # end if - - if not os.path.exists(options.image): - logging.critical('Sorry: the file %s does not exist', options.image) - - return 1 - # end if - - upload(options.host_url, options.image) -# end main - -if __name__ == '__main__': - sys.exit(main(sys.argv)) -# end if \ No newline at end of file diff --git a/pio/http-uploader.py b/pio/http-uploader.py deleted file mode 100644 index b80ee4a09..000000000 --- a/pio/http-uploader.py +++ /dev/null @@ -1,12 +0,0 @@ -Import("env") - -from base64 import b64decode - -env.Replace(UPLOADER="pio\espupload.py") -env.Replace(UPLOADERFLAGS="") -env.Replace(UPLOADCMD="$UPLOADER -u " + b64decode(ARGUMENTS.get("UPLOAD_PORT")) + " -f $SOURCES") - -''' -env.Replace(UPLOADCMD="pio\espupload.py -f $SOURCES") # Windows -env.Replace(UPLOADCMD="pio/espupload.py -f $SOURCES") # Linux -''' \ No newline at end of file diff --git a/pio/sftp-uploader.py b/pio/sftp-uploader.py deleted file mode 100644 index c6fe9fb84..000000000 --- a/pio/sftp-uploader.py +++ /dev/null @@ -1,6 +0,0 @@ -Import("env") -from base64 import b64decode - -env.Replace(UPLOADER="scp") -env.Replace(UPLOADERFLAGS="") -env.Replace(UPLOADCMD="$UPLOADER $SOURCES " + b64decode(ARGUMENTS.get("UPLOAD_PORT")) + "/" + b64decode(ARGUMENTS.get("PIOENV")) + ".bin") diff --git a/platformio.ini b/platformio.ini index 5b7ed8a1c..6c4c4a9c9 100644 --- a/platformio.ini +++ b/platformio.ini @@ -10,13 +10,13 @@ [platformio] src_dir = sonoff -; *** Uncomment one of the lines below to build/upload only one environment +; Uncomment one of the lines below to build/upload only one environment ;env_default = sonoff ;env_default = sonoff-NL ;env_default = sonoff-minimal ;env_default = sonoff-ds18x20 -; *** Sonoff et al +; Sonoff et al [env:sonoff] platform = espressif8266 framework = arduino @@ -25,21 +25,10 @@ board_flash_mode = dout build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=512 lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON -; *** Serial Monitor options +; Serial Monitor options monitor_baud = 115200 -; *** Upload Serial reset method for Wemos and NodeMCU -;upload_resetmethod = nodemcu - -; *** Upload file to OTA server using SCP -;upload_port = user@host:/path -;extra_scripts = pio/sftp-uploader.py - -; *** Upload file to OTA server using HTTP -;upload_port = domus1:80/api/upload-arduino.php -;extra_scripts = pio/http-uploader.py - -; *** Sonoff et al +; Sonoff et al [env:sonoff-NL] platform = espressif8266 framework = arduino @@ -48,20 +37,9 @@ board_flash_mode = dout build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=512 -DMY_LANGUAGE=nl-NL lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON -; *** Serial Monitor options +; Serial Monitor options monitor_baud = 115200 -; *** Upload Serial reset method for Wemos and NodeMCU -;upload_resetmethod = nodemcu - -; *** Upload file to OTA server using SCP -;upload_port = user@host:/path -;extra_scripts = pio/sftp-uploader.py - -; *** Upload file to OTA server using HTTP -;upload_port = domus1:80/api/upload-arduino.php -;extra_scripts = pio/http-uploader.py - ; Sonoff minimal [env:sonoff-minimal] ; Placeholder to be configured platform = espressif8266 @@ -74,17 +52,6 @@ lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON ; Serial Monitor options monitor_baud = 115200 -; *** Upload Serial reset method for Wemos and NodeMCU -;upload_resetmethod = nodemcu - -; *** Upload file to OTA server using SCP -;upload_port = user@host:/path -;extra_scripts = pio/sftp-uploader.py - -; *** Upload file to OTA server using HTTP -;upload_port = domus1:80/api/upload-arduino.php -;extra_scripts = pio/http-uploader.py - ; Sonoff multiple DS18x20 [env:sonoff-ds18x20] platform = espressif8266 @@ -96,14 +63,3 @@ lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON, OneWire ; Serial Monitor options monitor_baud = 115200 - -; *** Upload Serial reset method for Wemos and NodeMCU -;upload_resetmethod = nodemcu - -; *** Upload file to OTA server using SCP -;upload_port = user@host:/path -;extra_scripts = pio/sftp-uploader.py - -; *** Upload file to OTA server using HTTP -;upload_port = domus1:80/api/upload-arduino.php -;extra_scripts = pio/http-uploader.py