From a84d146921bc2ab205fdbef7988165e775263ccd Mon Sep 17 00:00:00 2001 From: Luc Date: Sat, 26 Jan 2019 09:31:25 +0100 Subject: [PATCH] Prepare branch --- .travis.yml | 52 - README.md | 138 +- UI/repetier/testui.htm | 840 -------- docs/Commands.txt | 115 - embedded/build.bat | 1 - embedded/gulpfile.js | 125 -- embedded/install.bat | 15 - embedded/package.json | 30 - embedded/tool.html.gz | Bin 4776 -> 0 bytes embedded/www/css/style.css | 139 -- embedded/www/js/script.js | 249 --- embedded/www/tool.html | 100 - esp3d/GenLinkedList.h | 340 --- esp3d/bridge.cpp | 209 -- esp3d/bridge.h | 49 - esp3d/command.cpp | 1600 -------------- esp3d/command.h | 43 - esp3d/config.cpp | 1865 ----------------- esp3d/config.h | 430 ---- esp3d/data/404.htm | 18 - esp3d/data/favicon.ico | Bin 1150 -> 0 bytes esp3d/data/index.html.gz | Bin 79777 -> 0 bytes esp3d/data/macrocfg.json | 74 - esp3d/esp3d.ino | 189 -- esp3d/nofile.h | 326 --- esp3d/storestrings.cpp | 139 -- esp3d/storestrings.h | 61 - esp3d/webinterface.cpp | 1740 --------------- esp3d/webinterface.h | 90 - esp3d/wificonf.cpp | 505 ----- esp3d/wificonf.h | 62 - libraries/WebServer/.gitignore | 32 - libraries/WebServer/.travis.yml | 99 - libraries/WebServer/LICENSE | 504 ----- libraries/WebServer/README.md | 9 - .../AdvancedWebServer/AdvancedWebServer.ino | 160 -- .../examples/FSBrowser/FSBrowser.ino | 345 --- .../examples/FSBrowser/data/edit.htm.gz | Bin 4116 -> 0 bytes .../examples/FSBrowser/data/favicon.ico | Bin 1150 -> 0 bytes .../examples/FSBrowser/data/graphs.js.gz | Bin 1971 -> 0 bytes .../examples/FSBrowser/data/index.htm | 97 - .../examples/HelloServer/HelloServer.ino | 91 - .../examples/HttpBasicAuth/HttpBasicAuth.ino | 47 - .../examples/SDWebServer/SDWebServer.ino | 290 --- .../SDWebServer/SdRoot/edit/index.htm | 674 ------ .../examples/SDWebServer/SdRoot/index.htm | 22 - .../examples/SDWebServer/SdRoot/pins.png | Bin 177869 -> 0 bytes .../SimpleAuthentification.ino | 137 -- .../examples/WebUpdate/WebUpdate.ino | 78 - libraries/WebServer/keywords.txt | 36 - libraries/WebServer/library.properties | 9 - libraries/WebServer/src/ESP8266WebServer.h | 29 - libraries/WebServer/src/Parsing.cpp | 610 ------ libraries/WebServer/src/WebServer.cpp | 530 ----- libraries/WebServer/src/WebServer.h | 236 --- .../WebServer/src/detail/RequestHandler.h | 19 - .../src/detail/RequestHandlersImpl.h | 191 -- 57 files changed, 2 insertions(+), 13787 deletions(-) delete mode 100644 UI/repetier/testui.htm delete mode 100644 docs/Commands.txt delete mode 100644 embedded/build.bat delete mode 100644 embedded/gulpfile.js delete mode 100644 embedded/install.bat delete mode 100644 embedded/package.json delete mode 100644 embedded/tool.html.gz delete mode 100644 embedded/www/css/style.css delete mode 100644 embedded/www/js/script.js delete mode 100644 embedded/www/tool.html delete mode 100644 esp3d/GenLinkedList.h delete mode 100644 esp3d/bridge.cpp delete mode 100644 esp3d/bridge.h delete mode 100644 esp3d/command.cpp delete mode 100644 esp3d/command.h delete mode 100644 esp3d/config.cpp delete mode 100644 esp3d/config.h delete mode 100644 esp3d/data/404.htm delete mode 100644 esp3d/data/favicon.ico delete mode 100644 esp3d/data/index.html.gz delete mode 100644 esp3d/data/macrocfg.json delete mode 100644 esp3d/esp3d.ino delete mode 100644 esp3d/nofile.h delete mode 100644 esp3d/storestrings.cpp delete mode 100644 esp3d/storestrings.h delete mode 100644 esp3d/webinterface.cpp delete mode 100644 esp3d/webinterface.h delete mode 100644 esp3d/wificonf.cpp delete mode 100644 esp3d/wificonf.h delete mode 100644 libraries/WebServer/.gitignore delete mode 100644 libraries/WebServer/.travis.yml delete mode 100644 libraries/WebServer/LICENSE delete mode 100644 libraries/WebServer/README.md delete mode 100644 libraries/WebServer/examples/AdvancedWebServer/AdvancedWebServer.ino delete mode 100644 libraries/WebServer/examples/FSBrowser/FSBrowser.ino delete mode 100644 libraries/WebServer/examples/FSBrowser/data/edit.htm.gz delete mode 100644 libraries/WebServer/examples/FSBrowser/data/favicon.ico delete mode 100644 libraries/WebServer/examples/FSBrowser/data/graphs.js.gz delete mode 100644 libraries/WebServer/examples/FSBrowser/data/index.htm delete mode 100644 libraries/WebServer/examples/HelloServer/HelloServer.ino delete mode 100644 libraries/WebServer/examples/HttpBasicAuth/HttpBasicAuth.ino delete mode 100644 libraries/WebServer/examples/SDWebServer/SDWebServer.ino delete mode 100644 libraries/WebServer/examples/SDWebServer/SdRoot/edit/index.htm delete mode 100644 libraries/WebServer/examples/SDWebServer/SdRoot/index.htm delete mode 100644 libraries/WebServer/examples/SDWebServer/SdRoot/pins.png delete mode 100644 libraries/WebServer/examples/SimpleAuthentification/SimpleAuthentification.ino delete mode 100644 libraries/WebServer/examples/WebUpdate/WebUpdate.ino delete mode 100644 libraries/WebServer/keywords.txt delete mode 100644 libraries/WebServer/library.properties delete mode 100644 libraries/WebServer/src/ESP8266WebServer.h delete mode 100644 libraries/WebServer/src/Parsing.cpp delete mode 100644 libraries/WebServer/src/WebServer.cpp delete mode 100644 libraries/WebServer/src/WebServer.h delete mode 100644 libraries/WebServer/src/detail/RequestHandler.h delete mode 100644 libraries/WebServer/src/detail/RequestHandlersImpl.h diff --git a/.travis.yml b/.travis.yml index f5fdc0af..8b137891 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,53 +1 @@ -sudo: false -language: bash - -os: - - linux - -before_install: - - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16" - -before_script: - - "export DISPLAY=:99.0" - - sleep 3 # give xvfb some time to start - - wget http://downloads.arduino.cc/arduino-1.8.4-linux64.tar.xz - - tar xf arduino-1.8.4-linux64.tar.xz - - mv arduino-1.8.4 $HOME/arduino_ide - - cd $HOME/arduino_ide/hardware - - mkdir esp8266com - - cd esp8266com - - git clone https://github.com/esp8266/Arduino.git esp8266 - - cd esp8266/tools - - python get.py - - cd .. - - echo 'build.flash_ld=eagle.flash.4m.ld' >> platform.txt - - echo 'build.flash_freq=40' >> platform.txt - - echo 'build.flash_size=4M' >> platform.txt - - echo 'build.flash_mode=dio' >> platform.txt - - echo 'build.f_cpu=160000000L' >> platform.txt - - sed -i "s/generic.build.f_cpu=80000000L/generic.build.f_cpu=160000000L/g" ./boards.txt - - cd $HOME/arduino_ide/hardware - - mkdir esp32 - - cd esp32 - - git clone https://github.com/espressif/arduino-esp32.git esp32 - - cd esp32/tools - - python get.py - - cd .. - - echo 'build.flash_freq=40m' >> platform.txt - - -script: - - cd $TRAVIS_BUILD_DIR - - source command.sh - - export PATH="$HOME/arduino_ide:$PATH" - - arduino --board esp8266com:esp8266:generic --save-prefs - - arduino --get-pref sketchbook.path - - build_sketch esp3d/esp3d.ino - - arduino --board esp32:esp32:esp32 --save-prefs - - build_sketch esp3d/esp3d.ino - -notifications: - email: - on_success: change - on_failure: change diff --git a/README.md b/README.md index 7d808d8f..be97a8fc 100644 --- a/README.md +++ b/README.md @@ -1,137 +1,3 @@ -# ESP3D[![Code Climate](https://codeclimate.com/github/luc-github/ESP3D/badges/gpa.svg)](https://codeclimate.com/github/luc-github/ESP3D) +# ESP3D 3.0 -Firmware for ESP8266/ESP8285 and ESP32 used with 3D printer using [ESP8266 core version](https://github.com/esp8266/Arduino) and [ESP32 core version](https://github.com/espressif/arduino-esp32) - -This firmware allows not only to have a cheap bridge between Wifi and serial, but also to have a web UI to configure wifi, to monitor 3D printer and even control it, and to make things easy, -UI is fully customizable without reflashing FW. - -Firmware should work with any 3D printer firmware (repetier/marlin/smoothieware using GCODE) if serial connection has a correct setup. -I currently use it with my personnal flavor of [repetier for Due based boards](https://github.com/luc-github/Repetier-Firmware-0.92). - -The web interface files are present in data directory but UI has it's own repository [ESP3D-WEBUI](https://github.com/luc-github/ESP3D-WEBUI). -* be aware ESP3D-WEBUI is for firmware 0.9.99 minimum - previous released version use tpl files which are no more used. - -Stable version (ESP8266 only): -Arduino ide 1.6.5 with stable [2.0.0](http://arduino.esp8266.com/versions/2.0.0/package_esp8266com_index.json) from ESP8266, please use https://github.com/luc-github/ESP3D/releases/tag/v0.5.1 -Arduino ide 1.6.8 with stable [2.2.0](http://arduino.esp8266.com/versions/2.2.0/package_esp8266com_index.json) from ESP8266, please use https://github.com/luc-github/ESP3D/releases/tag/v0.6.2 -Arduino ide 1.8.5 with stable [2.4.0](http://arduino.esp8266.com/versions/2.4.0/package_esp8266com_index.json) from ESP8266, please use https://github.com/luc-github/ESP3D/releases/tag/1.0 [![Build Status](https://travis-ci.org/luc-github/ESP3D.svg?branch=master)](https://travis-ci.org/luc-github/ESP3D) - -[Development version for 2.0 (2.0 branch)](https://github.com/luc-github/ESP3D/tree/2.0) & [ESP-WEBUI (2.0 branch)](https://github.com/luc-github/ESP3D-WEBUI/tree/2.0): -Arduino ide 1.8.5 with git version from ESP8266 or ESP32 for 100% support of ESP32 : [![Build Status](https://travis-ci.org/luc-github/ESP3D.svg?branch=2.0)](https://travis-ci.org/luc-github/ESP3D) - -[All releases](https://github.com/luc-github/ESP3D/wiki) - -:+1:Thanks -* to @disneysw for bringing this module idea -* to @lkarlslund for suggestion about independent reset using GPIO2 -* to Roy Cortes from http://www.panucatt.com for supporting and pushing me implementing great features -* to all contributors, feedbacks owners and donations. - -## Donate -Every support is welcome: [PayPal – The safer, easier way to pay online.](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y8FFE7NA4LJWQ) -Especially if need to buy new modules for testing. - -## Features -* Serial/Wifi bridge using configurable port 8888, here to enable/disable [TCP_IP_DATA_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h) -* Use GPIO2 to ground to reset all settings in hard way - 2-6 sec after boot / not before!! Set GPIO2 to ground before boot change boot mode and go to special boot that do not reach FW. Currently boot take 10 sec - giving 8 seconds to connect GPIO2 to GND and do an hard recovery for settings, here to enable/disable [RECOVERY_FEATURE](https://github.com/luc-github/ESP8266/blob/master/esp8266/config.h) -* Complete configuration by web browser (Station or Access point) or by Serial commands -* Authentication for sensitive pages, here to enable/disable [AUTHENTICATION_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h) -* Update firmware by web browser, here to enable/disable [WEB_UPDATE_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h) -* Control ESP module using commands on serial or data port, here to enable/disable [SERIAL_COMMAND_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h) -* UI fully constomizable without reflashing FW using html templates, [keywords](https://raw.githubusercontent.com/luc-github/ESP3D/master/docs/keywords.txt) and html files/images -* Captive portal in Access point mode which redirect all unknow call to main page, here to enable/disable [CAPTIVE_PORTAL_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h) -* mDNS which allows to key the name defined in web browser and connect only with bonjour installed on computer, here to enable/disable [MDNS_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h) -* SSDP, this feature is a discovery protocol, supported on Windows out of the box, here to enable/disable [SSDP_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h) -* Printer monitoring / control (temperatures/speed/jog/list SDCard content/launch,pause or stop a print/etc...), here to enable/disable [MONITORING_FEATURE/INFO_MSG_FEATURE/ERROR_MSG_FEATURE/STATUS_MSG_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h) -* Fail safe mode (Access point)is enabled if cannot connect to defined station at boot. -* The web ui add even more feature : https://github.com/luc-github/ESP3D-WEBUI/blob/master/README.md#features - - -## Web configuration -*Wifi Mode : Access point / Client station -*IP Generation: DHCP/Static IP -*IP/MASK/GATEWAY for static data -*Baud Rate for serial (supported : 9600, 19200, 38400, 57600, 115200, 230400, 250000) -*web port and data port - - -## Default Configuration -Default Settings: -AP:ESP8266 -PW:12345678 -Authentification: WPA -Mode: g (n is not supported by AP, just by STA) -channel: 11 -AP: visible -Sleep Mode: Modem -IP Mode: Static IP -IP: 192.168.0.1 -Mask: 255.255.255.0 -GW:192.168.0.1 -Baud rate: 115200 -Web port:80 -Data port: 8888 -Web Page refresh: 3 secondes -User: admin -Password: admin -User:user -Password: user - - - -## Direct commands: -Check wiki : https://github.com/luc-github/ESP3D/wiki/Direct-ESP3D-commands - -## Installation -1. Please follow installation of the ESP core you want to use : [ESP8266 core version](https://github.com/esp8266/Arduino) or [ESP32 core version](https://github.com/espressif/arduino-esp32) -2. Add missing libraries if you target ESP32 present in libraries directory -* DNSServer (from https://github.com/bbx10/DNSServer_tng) -* WebServer (from https://github.com/bbx10/WebServer_tng) -* NetBIOS and SSDP are currently disabled for ESP32 as not yet supported -3. Compile project (ESP3D.ino) according target: ESP8266 board or ESP32 board, please review config.h to enable disable a feature, by default athenticatio is disabled and all others are enabled. -* for ESP8266 set CPU freq to 160MHz for better (https://github.com/luc-github/ESP3D/wiki/Install-Instructions) -4. Upload the data content on ESP3D file system -* Using SPIFFS uploader, this plugin and install instructions is available on each ESP core - please refere to it -* Using embedded uploader (you may need to format SPIFFS using : [ESP710]FORMAT on ESP8266 first) -if embedded uploader does not show up you can force it ti display using : http://your_IP_address?forcefallback=yes -
- -## Update -* Generate a binary using the export binary menu from Arduino IDE and upload it using ESP-WEBUI or embedded interface - -

:warning:Do not flash your Printer fw with ESP connected - it bring troubles, at least on DaVinci

- -## Contribution/customization -* To style the code before pushing PR please use [astyle --style=otbs *.h *.cpp *.ino](http://astyle.sourceforge.net/) -* The embedded page is created using nodejs then gulp to generate a compressed html page (tool.html.gz), all necessary modules can be installed using the install.bat file content, then it is included using bin2c (https://sourceforge.net/projects/bin2c/) to generate the h file used to create the file nofile.h, update the array and size according new out.h. -* The current UI is located [here](https://github.com/luc-github/ESP3D-WEBUI) -* An optional UI is under development using old repetier UI - check [UI\repetier\testui.htm] (https://github.com/luc-github/ESP3D/blob/master/UI/repetier/testui.htm) file - -Feedback/suggestion/discussions are always welcome - -## Need more information about supported boards or wiring ? -[Check the wiki](https://github.com/luc-github/ESP3D/wiki) - -## :question:Any question ? -Check [Wiki](https://github.com/luc-github/ESP3D/wiki/Install-Instructions) or [![Join the chat at https://gitter.im/luc-github/ESP3D](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/luc-github/ESP3D?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -## :exclamation:Any issue/feedback ? -Check [Wiki](https://github.com/luc-github/ESP3D/wiki/Install-Instructions) and [FAQ](https://github.com/luc-github/ESP3D/issues?utf8=%E2%9C%93&q=label%3AFAQ+) or [submit ticket](https://github.com/luc-github/ESP3D/issues) - -## ESP3D is used by : -* Custom version is used on azteeg mini wifi : http://www.panucatt.com/azteeg_X5_mini_reprap_3d_printer_controller_p/ax5mini.htm -* GRBL_Esp32 a GRBL port on ESP32 done by @bdring - https://github.com/bdring/Grbl_Esp32 -[![](https://img.youtube.com/vi/7vtWNn9jyDs/mqdefault.jpg)](https://www.youtube.com/watch?v=7vtWNn9jyDs) -* Marlin_ESP32 a Marlin port on ESP32 done by @simon-jouet is under sync : https://github.com/luc-github/Marlin/tree/eps32_webui -* More to come... - -If you use ESP3D on your product, drop me a message so I can link your product page here. - - - -## TODO/On going : --- Version 2.X --- Close open topics --- Do testing (a lot) --- UI Improvement --- ESP3D V2 +

Coming Soon!

diff --git a/UI/repetier/testui.htm b/UI/repetier/testui.htm deleted file mode 100644 index c8a7bf59..00000000 --- a/UI/repetier/testui.htm +++ /dev/null @@ -1,840 +0,0 @@ - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -X - -0.00 - - - - -Y - -100.00 - - - - -Z - -0.00 - - - - - - - -
-
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - X - - - - - - - - - Y - - - - - - - - - Z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -X/Y - - - - - - - - - - - - - - - -Z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -P - - - - - - -1 - - - - - - -2 - - - - - - -3 - - - - - - -4 - - - - - - -5 - - - - - - -? - - - - -
-
-
- - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - Feedrate - -
-
- -
-
- - - - - - - - -
- - - - - - - - Flowrate - -
-
- -
- - - - - - - - -
- - - - - - - - Fan - -
-
- -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -Bed Temperature -60.43°C - - -
-
- -
-
- - - - -1 - - - - -
- - - - - - - - - - - - - - - - -Extruder 1 -180.03°C - - -
-
-
-
- - - - -2 - - - - -
- - - - - - - - - - - - - - - - -Extruder 2 -180.03°C - - -
-
-
-
-
- - - diff --git a/docs/Commands.txt b/docs/Commands.txt deleted file mode 100644 index 501fc2c7..00000000 --- a/docs/Commands.txt +++ /dev/null @@ -1,115 +0,0 @@ -* Change STA SSID -[ESP100] -if authentication is on, need admin password -[ESP100]pwd= - -* Change STA Password -[ESP101] -if authentication is on, need admin password -[ESP101]pwd= - -* Change Hostname -[ESP102] -if authentication is on, need admin password -[ESP102]pwd= - -* Change Wifi mode (STA/AP) -[ESP103] -if authentication is on, need admin password -[ESP103]pwd= - -* Change STA IP mode (DHCP/STATIC) -[ESP104] -if authentication is on, need admin password -[ESP104]pwd= - -* Change AP SSID -[ESP105] -if authentication is on, need admin password -[ESP105]pwd= - -* Change AP Password -[ESP106] -if authentication is on, need admin password -[ESP106]pwd= - -* Change AP IP mode (DHCP/STATIC) -[ESP107] -if authentication is on, need admin password -[ESP107]pwd= - -* Set wifi on/off -[ESP110] -state can be ON, OFF, RESTART -if authentication is on, need admin password -[ESP110]pwd= - -* Get current IP -[ESP111]
- -* Get hostname -[ESP112]
- -* Restart time client -[ESP114] - -*Get/Set pin value -[ESP201]P V [PULLUP=YES RAW=YES]pwd= -if no V get P value -if V 0/1 set INPUT_PULLUP value, but for GPIO16 INPUT_PULLDOWN_16 -GPIO1 and GPIO3 cannot be used as they are used for serial -if PULLUP=YES set input pull up, if not set input -if RAW=YES do not set pinmode just read value - - -*Save data string -[ESP300] pwd= -*Get data string -[ESP301] pwd= - -*Get full EEPROM settings content -but do not give any passwords -can filter if only need wifi or printer -[ESP400] - -*Set EEPROM setting -position in EEPROM, type: B(byte), I(integer/long), S(string), A(IP address / mask) -[ESP401]P= T= V= pwd= - -*Get available AP list (limited to 30) -output is JSON or plain text according parameter -[ESP410] - -*Get current settings of ESP3D -output is JSON or plain text according parameter -[ESP420] - -* Get/Set ESP mode -cmd can be RESET, SAFEMODE, CONFIG, RESTART -[ESP444] -if authentication is on, need admin password for RESET, RESTART and SAFEMODE -[ESP444]pwd= - -* Change / Reset user password -[ESP555]pwd= -if no password set it use default one - -* Read SPIFFS file and send each line to serial -[ESP700] - -* Format SPIFFS -[ESP710]FORMAT pwd= - -* SPIFFS total size and used size -[ESP720]
- -* Get fw version and basic information -[ESP800]
- -* Get fw target -[ESP801]
- -* Clear status/error/info list -cmd can be ALL, ERROR, INFO, STATUS -[ESP999] - diff --git a/embedded/build.bat b/embedded/build.bat deleted file mode 100644 index f4a9a8df..00000000 --- a/embedded/build.bat +++ /dev/null @@ -1 +0,0 @@ -bin2c /infile tool.html.gz /outfile out.h /targetfolder . diff --git a/embedded/gulpfile.js b/embedded/gulpfile.js deleted file mode 100644 index 8deb4a79..00000000 --- a/embedded/gulpfile.js +++ /dev/null @@ -1,125 +0,0 @@ -var gulp = require('gulp'), - jshint = require('gulp-jshint'), - gulpif = require('gulp-if'), - concat = require('gulp-concat'), - uglify = require('gulp-uglify'), - cleanCSS = require('gulp-clean-css'), - removeCode = require('gulp-remove-code'), - merge = require('merge-stream'), - del = require('del'), - zip = require('gulp-zip'), - gzip = require('gulp-gzip'), - htmlmin = require('gulp-htmlmin'), - replace = require('gulp-replace'), - fs = require('fs'), - smoosher = require('gulp-smoosher'); - -var demoMode = false; -var testMode = false; - -function clean() { - return del(['dist']); -} - -function clean2() { - return del(['dist/js', 'dist/css']); -} -function lint() { - return gulp.src('www/js/**/script.js') - .pipe(jshint()) - .pipe(jshint.reporter('default')); -} - -function Copytest() { - return merge( - gulp.src(['www/tool.html']) - .pipe(removeCode({production: false})) - .pipe(gulp.dest('dist')), - gulp.src(['www/images/**/*.*']) - .pipe(gulp.dest('dist/images')) - ) -} - -function Copy() { - return merge( - gulp.src(['www/tool.html']) - .pipe(removeCode({production: true})) - .pipe(gulp.dest('dist')), - gulp.src(['www/images/**/*.*']) - .pipe(gulp.dest('dist/images')) - ) -} - -function concatApptest() { - return merge( - gulp.src([ 'www/js/**/*.js']) - .pipe(concat('script.js')) - .pipe(removeCode({production: false})) - .pipe(gulp.dest('./dist/js')), - - gulp.src([ 'www/css/**/*.css']) - .pipe(concat('style.css')) - .pipe(gulp.dest('./dist/css/')) - ) -} - -function concatApp() { - return merge( - gulp.src([ 'www/js/**/*.js']) - .pipe(concat('script.js')) - .pipe(removeCode({production: true})) - .pipe(gulp.dest('./dist/js')), - - gulp.src([ 'www/css/**/*.css']) - .pipe(concat('style.css')) - .pipe(gulp.dest('./dist/css/')) - ) -} - -function minifyApp() { - return merge( - gulp.src(['dist/js/script.js']) - .pipe(uglify({mangle: true})) - .pipe(gulp.dest('./dist/js/')), - - gulp.src('dist/css/style.css') - .pipe(cleanCSS({debug: true}, function(details) { - console.log(details.name + ': ' + details.stats.originalSize); - console.log(details.name + ': ' + details.stats.minifiedSize); - })) - .pipe(gulp.dest('./dist/css/')), - - gulp.src('dist/tool.html') - .pipe(htmlmin({collapseWhitespace: true, minifyCSS: true})) - .pipe(gulp.dest('dist')) - ) -} - -function smoosh() { - return gulp.src('dist/tool.html') - .pipe(smoosher()) - .pipe(gulp.dest('dist')) -} - -function compress() { - return gulp.src('dist/tool.html') - .pipe(gzip()) - .pipe(gulp.dest('.')); -} - -gulp.task(clean); -gulp.task(lint); -gulp.task(Copy); -gulp.task(Copytest); -gulp.task(concatApp); -gulp.task(concatApptest); -gulp.task(minifyApp); -gulp.task(smoosh); -gulp.task(clean2); - -var defaultSeries = gulp.series(clean, lint, Copy, concatApp, smoosh); -var packageSeries = gulp.series(clean, lint, Copy, concatApp,minifyApp, smoosh, compress, clean2); - -gulp.task('default', defaultSeries); -gulp.task('package', packageSeries); - diff --git a/embedded/install.bat b/embedded/install.bat deleted file mode 100644 index e3f2831a..00000000 --- a/embedded/install.bat +++ /dev/null @@ -1,15 +0,0 @@ -npm install --global gulp-cli -npm install --save-dev gulp -npm install --save-dev gulp-jshint -npm install --save-dev jshint -npm install --save-dev gulp-if -npm install --save-dev gulp-concat -npm install --save-dev gulp-uglify -npm install --save-dev gulp-clean-css -npm install --save-dev gulp-remove-code -npm install --save-dev del -npm install --save-dev gulp-zip -npm install --save-dev gulp-gzip -npm install --save-dev gulp-htmlmin -npm install --save-dev gulp-replace -npm install --save-dev gulp-smoosher diff --git a/embedded/package.json b/embedded/package.json deleted file mode 100644 index 00299619..00000000 --- a/embedded/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "embedded4ESP3D", - "description": "Embedded files for ESP3D", - "devDependencies": { - "del": "^2.2.2", - "deprecated": "0.0.1", - "fs": "0.0.1-security", - "gulp": "github:gulpjs/gulp#4.0", - "gulp-bytediff": "^1.0.0", - "gulp-cdnizer": "^1.1.7", - "gulp-clean-css": "^2.4.0", - "gulp-concat": "^2.6.1", - "gulp-gzip": "^1.4.0", - "gulp-htmlmin": "^3.0.0", - "gulp-if": "^2.0.2", - "gulp-jshint": "^2.0.4", - "gulp-ng-annotate": "^2.0.0", - "gulp-remove-code": "^1.0.2", - "gulp-replace": "^0.5.4", - "gulp-smoosher": "0.0.9", - "gulp-uglify": "^2.1.2", - "gulp-util": "^3.0.1", - "gulp-zip": "^3.2.0", - "jshint": "^2.9.5", - "merge-stream": "^1.0.1" - }, - "repository": "https://github.com/luc-github/ESP3D", - "author": "Luc LEBOSSE", - "license": "(ISC OR GPL-3.0)" -} diff --git a/embedded/tool.html.gz b/embedded/tool.html.gz deleted file mode 100644 index de11ef0170ba9cdda845977d8bdfbb586c26aef0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4776 zcmV;Z5?AdXiwFP!000003+-HeliEg;|0=RlHgGFgNxY*4KS>;4eC5P0@A~el;*?8B z1L(1kbkeZ9nDE`NdtRiG5G=b%o;-gfcoED@_w@91|GKA#%GHXl!`an}xc=-aquY?o zuw}Q1BidfL>mb}tGB?WF8A*eM(_Uw7O73Yp3%-)J>;H3;(TQc6&z<%inSTlBkzU3Q zTj6VRzn{ncwlszQBMEN_4Ln!-nQVw|ExSkx9iMZ@5?fcH<8~Kt&7EC-|>Kt3&iPe?WW5hYNw2cyP>foT0*iA z4Txqq;q(HU`C}FdZNfh6uZX#uy*z5J4u6Ars z+%Q;16O>;}JfpY`Gn&q*ZyYqO@+M{*M%!6FVgK+J&Di%_yBb>^ z<7@wqHSq&iYp%fnIN#v_bl%!2b}ZWaXc#pF!FdiNuux!(;rLZhc(uv$#)og{x zp668@#;m%F3C5Cv8zbU?)kdVoOPTL-g{H0_Y_iD!jI729++7l90S)44l9JG+!7Xw8 zAWK4bJDG>E_a%1-L?4a0FY^hXcya17LMB5Y|GwjT$Y)m|Mva7~Y080`Yq*m|>}@i5 zu41tHoeDOI8dxc)cD8c;_-x^qyr zw16ODxWo;i48av+!d0;7a>p@jh}+8yC5RTW+|Mo;{|L5p5vS`mdPW)-lkr*j3@mU6 zIPCU{kb!2bS+<<)+)&o<_m5di(HgAXrF5tR8$!Q4%Z7p|BUC$LB*U^PJvg=(m#0UB{L0=jL-8>)4zer6PW5Bkaq=dQLZ+tXm+F38vc3e+S7+$Su}FrjlKJ1o;S ztYP12~WV{jkjte z?0`PkZWJV&kb#(UyvN(58K@|U1IGMJi(&hgxG6~FoJcbsY0ot#xQ@TJHyI{NBqSc? z;^0~j8mkRV=j|kgWu)8FXx;4&-TAPBK{grqZm+~eAi7a%q}O?8!bUwHPC1K#3vO_WbS#sB{{j{ zUax2GJ1aM9lQad$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{&5A`d>tHwM$k1^0fkcN0H z-uf7Fd+0?y^t(QDKAR222L@_%#V(`ovv-?&BJ`gZrwgOfaa+nK04?ACJgYgp4pUKA z3H8c$g~fI`a=$8lCF79tJlR%`&;KNIIU4VZnp8RD9VK9;I(4i(E*2??uy)Lp;t1>a zP5pcRLG!T-$HWWVOr9QqIhOJ#Hi$q5d%#mBV5iu^7}&r#-JakLW6JE60P>t;)tP94gkDNiLLa;N?8Pj7#u zG!Z9wI8f`C%miNY-yck2O%OLBlfqVBwz?pZ7yIPnhc`{yGFT@|8q^LoaXG%ZqG;Rd zFjwgml`K)!3SrGrCyroo{uWau;;rx}ebYQQXzd{5>`kXphmFBxleD18Hcf2g>6O&+ ze_g-(84x{%1Q*9=NgQS5hTPK=275w8QEfA7Q{p`dVH+#ukv*;^AyHHR&mV5!TyH!x zThNrj_B1Qo#mkJlyp7p6EQ|=yh3!l>tOOvlZ^D06;9rWA`9C0gJ-#lyZE1CQMtj2j z%J)E$K$JoO)wE8hqhH|R;Wgg5H_aC2yZb#C=_Cxu;%$p#4jvuMXH!{kY3-gY6N+>K zP}stc8=O=4#_Kp;zjCSTL>)ItaFaM3sd;ua<)mt|x#J-d%Q^~=qD*asDyxf7q_Ifl z*LbJn3+s9R?)nB#2#k-;tjO&^;zi75 zrhe`-Pt*SsG@tv?dDbGP)14Z>Q#{-+d$@2&_S62R{w+8Z`%yWb(_jPqXK-`|#V}8d zTKmEm)uR8O>Wz!LbNmqt|7tXR*b_m@gZNdsjL}}|Eh+c$O}P7=4qIHQJk1D{`JX_} z6?Y=eoUif|W5rJZ+An{_u*Cj5Q;;tKYsVqo15ttGsd6}@q-6WT5!w?lw;P57XabUph>!B*#h=P zpq_Oi7B&KT)GXb diff --git a/embedded/www/css/style.css b/embedded/www/css/style.css deleted file mode 100644 index d8b50635..00000000 --- a/embedded/www/css/style.css +++ /dev/null @@ -1,139 +0,0 @@ -html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%; font-size:10px;} -body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333333;background-color:#ffffff;} -.container{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px;} -table{border:0px;border-spacing:0;max-width:100%;} -.table-bordered{ width:100%; border:1px solid #dddddd;margin-bottom:20px;} -td{white-space:nowrap; padding:2mm;} -th{text-align:left;} -.table>thead>tr>th,.table>tbody>tr>th,.table>thead>tr>td,.table>tbody>tr>td{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #dddddd;} -.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td{border:1px solid #dddddd;} -.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px;} -.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9;} -@media (min-width:768px){.container{width:750px;}} -@media (min-width:992px){.container{width:970px;}} -@media (min-width:1200px){.container{width:1170px;}} -.nav{ width:100%; color:#cccccc;padding-left:10;padding-right:10;list-style:none;background-color:#333333;border-radius:6px ;margin-bottom:20px;} -a{position:relative;display:block;padding:10px 15px;text-decoration:none;color:#cccccc;} -.active{color:#ffffff;background-color:#000000;} -.active a,a:hover,a:focus{color:#FFFFFF;} -.panel{margin-bottom:20px;background-color:#ffffff;border:1px solid #dddddd;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.05);box-shadow:0 1px 1px rgba(0,0,0,0.05);} -.panel-body{padding:15px;} -.panel-heading{padding:10px 15px;color:#333333;background-color:#f5f5f5;border-color:#dddddd;border-top-right-radius:3px;border-top-left-radius:3px;border-bottom:1px solid #dddddd;} -label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:bold;} -.text-info{color:#31708f;} -.form-control{display:block;width:auto;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555555;background-color:#ffffff -;background-image:none;border:1px solid #cccccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075); -* -webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s; -* transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,0.6); -* box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,0.6);} -.form-group{margin-bottom:15px;} -.btn{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation; touch-action:manipulation;cursor:pointer; -background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px; -* -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;} -.btn-primary{color:#ffffff;background-color:#337ab7;border-color:#2e6da4;} -.btn-primary:focus,.btn-primary:active,.btn-primary:hover,.btn-primary.focus,.btn-primary.active,.btn-primary.hover{color:#ffffff;background-color:#286090;border-color:#122b40;} -caption{padding-top:8px;padding-bottom:8px;color:#777777;text-align:left;} -.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px;} -.alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#3c763d;} -.alert-danger{background-color:#f2dede;border-color:#ebccd1;color:#a94442;} -.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);} -.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483;} -.has-error .control-label{color:#a94442;} -.has-success .form-control {border-color: #3c763d;-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);} -.has-success .form-control:focus {border-color: #2b542c;-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168;box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168;} -.has-success .control-label{color: #3c763d;} -.btn-danger{color:#ffffff;background-color:#d9534f;border-color:#d43f3a;} -.btn-danger:focus,.btn-danger:active,.btn-danger:hover,.btn-danger.focus,.btn-danger.active,.btn-danger.hover{color: #ffffff;background-color:#c9302c;border-color:#761c19;} -.btnimg {cursor:hand; border-radius:6px ;;border:1px solid #FFFFFF;} -.btnimg:hover{background-color:#F0F0F0;border-color:#00FFFF;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483;} -.btnroundimg {cursor:hand; border-radius:30px;} -.btnroundimg:hover{background-color:#F0F0F0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483;} -.blacklink {color:#000000;} -.blacklink:hover, .filelink:focus {color:#0094FF;} -input[type="file"]::-webkit-file-upload-button{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation; touch-action:manipulation;cursor:pointer; -background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px; -* -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none; color: #ffffff;background-color: #5bc0de;border-color: #46b8da;} -input[type="file"]::-webkit-file-upload-button:focus{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation; touch-action:manipulation;cursor:pointer; -background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px; -* -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none; color: #ffffff;background-color: #31b0d5;border-color: #1b6d85;} -input[type="file"]::-webkit-file-upload-button:hover{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation; touch-action:manipulation;cursor:pointer; -background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px; -* -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none; color: #ffffff;background-color: #31b0d5;border-color: #269abc;} -.filelink {color:#000000;} -.filelink:hover, .filelink:focus {color:#0094FF;} -.panel-footer{padding:10px 15px;color:#31708f;background-color:#f5f5f5;border-color:#dddddd;border-top:1px solid #dddddd;} -.loader { - border: 4px solid #f3f3f3; /* Light grey */ - border-top: 4px solid #3498db; /* Blue */ - border-radius: 50%; - width: 12px; - height: 12px; - animation: spin 2s linear infinite; -} - -@keyframes spin { - 0% { transform: rotate(0deg); } - 100% { transform: rotate(360deg); } -} -.panel-footer{padding:10px 15px;color:#31708f;background-color:#f5f5f5;border-color:#dddddd;border-top:1px solid #dddddd;} - -.modal { - display: none; /* Hidden by default */ - position: fixed; /* Stay in place */ - z-index: 10000; /* Sit on top */ - padding-top: 100px; /* Location of the box */ - left: 0; - top: 0; - width: 100%; /* Full width */ - height: 100%; /* Full height */ - overflow: auto; /* Enable scroll if needed */ - background-color: rgb(0,0,0); /* Fallback color */ - background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ -} - -/* Modal Content */ -.modal-content { - border-top-left-radius: 10px; - border-top-right-radius: 10px; - border-bottom-left-radius: 10px; - border-bottom-right-radius: 10px; - border: 2px solid #337AB7; - box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); - position: relative; - margin: auto; - padding: 0; - background-color: #fefefe; -} - -.modal-header { - padding: 2px 16px; - color: #0f0f0f; - background-color: #f2f2f2; - border-top-left-radius: 10px; - border-top-right-radius: 10px; - border-bottom: 1px solid #cfcfcf; -} - -.modal-body {padding: 10px 16px;} - -.modal-footer { - padding: 16px 16px; - height: 4.5em; - color: #0f0f0f; - background-color: #f2f2f2; - border-top: 1px solid #cfcfcf; - border-bottom-left-radius: 10px; - border-bottom-right-radius: 10px; -} - -@media (min-width: 768px) { - .modal-content { - width: 580px; - } -} - -@media screen and (max-width: 767px) { - .modal-content { - width: 100%; - } -} diff --git a/embedded/www/js/script.js b/embedded/www/js/script.js deleted file mode 100644 index f6f7428e..00000000 --- a/embedded/www/js/script.js +++ /dev/null @@ -1,249 +0,0 @@ -var currentpath = "/"; -function navbar(){ - var content=""; - var tlist = currentpath.split("/"); - var path="/"; - var nb = 1; - content+=""; - while (nb < (tlist.length-1)) - { - path+=tlist[nb] + "/"; - content+=""; - nb++; - } - content+="
/"+tlist[nb] +"/
"; - return content; -} -function trash_icon(){ - var content =""; - content +=""; - content +=""; - content +=""; - content +=""; - content +=""; - content +=""; - content +=""; - content +=""; - return content; -} -function back_icon(){ - var content =""; - return content; -} -function select_dir(directoryname){ - currentpath+=directoryname + "/"; - SendCommand('list','all'); -} -function compareStrings(a, b) { - // case-insensitive comparison - a = a.toLowerCase(); - b = b.toLowerCase(); - return (a < b) ? -1 : (a > b) ? 1 : 0; -} -function dispatchfilestatus(jsonresponse) -{ -var content =""; -content ="  Status: "+jsonresponse.status; -content +="  |  Total space: "+jsonresponse.total; -content +="  |  Used space: "+jsonresponse.used; -content +="  |  Occupation: "; -content +=" "+jsonresponse.occupation +"%"; -document.getElementById('status').innerHTML=content; -content =""; -if (currentpath!="/") - { - var pos = currentpath.lastIndexOf("/",currentpath.length-2); - var previouspath = currentpath.slice(0,pos+1); - content +=""+back_icon()+" Up.."; - } -jsonresponse.files.sort(function(a, b) { - return compareStrings(a.name, b.name); -}); -for (var i1=0;i1

"; - content +=jsonresponse.files[i1].size; - content +="
"; - content +=trash_icon(); - content +="
"; - } -} -//then display directories -for (var i2=0;i2 "; - content +=jsonresponse.files[i2].name; - content +=""; - content +="
"; - content +=trash_icon(); - content +="
"; - } -} - - document.getElementById('file_list').innerHTML=content; - document.getElementById('path').innerHTML=navbar();} -function Delete(filename){ -if (confirm("Confirm deletion of file: " + filename))SendCommand("delete",filename); -} -function Deletedir(filename){ -if (confirm("Confirm deletion of directory: " + filename))SendCommand("deletedir",filename); -} -function Createdir(){ -var filename = prompt("Please enter directory name", ""); -if (filename != null) { - SendCommand("createdir",filename.trim()); - } -} -function SendCommand(action,filename){ -var xmlhttp = new XMLHttpRequest(); -var url = "/files?action="+action; -url += "&filename="+encodeURI(filename); -url += "&path="+encodeURI(currentpath); -document.getElementById('loader').style.visibility="visible"; -xmlhttp.onreadystatechange = function() { - if (xmlhttp.readyState == 4 ) { - if(xmlhttp.status == 200) { - var jsonresponse = JSON.parse(xmlhttp.responseText); - document.getElementById('loader').style.visibility="hidden"; - dispatchfilestatus(jsonresponse);} - else SubmitRequest () - } -}; -xmlhttp.open("GET", url, true); -xmlhttp.send(); -} -function Sendfile(){ -var files = document.getElementById('file-select').files; -if (files.length==0)return; -document.getElementById('upload-button').value = "Uploading..."; -document.getElementById('prg').style.visibility = "visible"; -var formData = new FormData(); -formData.append('path', currentpath); -for (var i3 = 0; i3 < files.length; i3++) { -var file = files[i3]; - formData.append('myfiles[]', file, currentpath+file.name);} -var xmlhttp = new XMLHttpRequest(); -xmlhttp.open('POST', '/files', true); -//progress upload event -xmlhttp.upload.addEventListener("progress", updateProgress, false); -//progress function -function updateProgress (oEvent) { - if (oEvent.lengthComputable) { - var percentComplete = (oEvent.loaded / oEvent.total)*100; - document.getElementById('prg').value=percentComplete; - document.getElementById('upload-button').value = "Uploading ..." + percentComplete.toFixed(0)+"%" ; - } else { - // Impossible because size is unknown - } -} - -xmlhttp.onload = function () { - if (xmlhttp.status === 200) { -document.getElementById('upload-button').value = 'Upload'; -document.getElementById('prg').style.visibility = "hidden"; -document.getElementById('file-select').value=""; -var jsonresponse = JSON.parse(xmlhttp.responseText); -dispatchfilestatus(jsonresponse); - } else alert('An error occurred!'); -}; -xmlhttp.send(formData); -} - -window.onload = function() { -SendCommand('list','all'); -}; -function Uploadfile(){ -if (!confirm("Confirm Firmware Update ?"))return; -var files = document.getElementById('fw-select').files; -if (files.length==0)return; -document.getElementById('uploadfw-button').style.visibility = 'hidden'; -document.getElementById('fw-select').style.visibility = 'hidden'; -document.getElementById('msg').style.visibility = "visible"; -document.getElementById('msg').innerHTML=""; -document.getElementById('SPIFFS').style.display = "none"; -document.getElementById('prgfw').style.visibility = "visible"; -var formData = new FormData(); -for (var i4 = 0; i4 < files.length; i4++) { -var file = files[i4]; - formData.append('myfile[]', file, "/"+file.name);} -var xmlhttp = new XMLHttpRequest(); -xmlhttp.open('POST', '/updatefw', true); -//progress upload event -xmlhttp.upload.addEventListener("progress", updateProgress, false); -//progress function -function updateProgress (oEvent) { - if (oEvent.lengthComputable) { - var percentComplete = (oEvent.loaded / oEvent.total)*100; - document.getElementById('prgfw').value=percentComplete; - document.getElementById('msg').innerHTML = "Uploading ..." + percentComplete.toFixed(0)+"%" ; - } else { - // Impossible because size is unknown - } -} -xmlhttp.onload = function () { - if (xmlhttp.status === 200) { -document.getElementById('uploadfw-button').value = 'Upload'; -document.getElementById('msg').innerHTML="Restarting, please wait...."; -document.getElementById('counter').style.visibility = "visible"; -document.getElementById('uploadfw-button').style.visibility = 'hidden'; -document.getElementById('uploadfw-button').style.width = '0px'; -document.getElementById('fw-select').value=""; -document.getElementById('fw-select').style.visibility = 'hidden'; -document.getElementById('fw-select').style.width = '0px'; - -var jsonresponse = JSON.parse(xmlhttp.responseText); -if (jsonresponse.status=='1' || jsonresponse.status=='4' || jsonresponse.status=='1')alert("Update failed"); -if (jsonresponse.status=='2')alert('Update canceled!'); -else if (jsonresponse.status=='3') -{ - var i5 = 0; - var interval; - var x = document.getElementById("prgfw"); - x.max=40; - interval = setInterval(function(){ - i5=i5+1; - var x = document.getElementById("prgfw"); - x.value=i5; - document.getElementById('counter').innerHTML=41-i5; - if (i5>40) - { - clearInterval(interval); - location.reload(); - } - },1000); -} -else alert('Update failed!'); - } else alert('An error occurred!'); -}; -xmlhttp.send(formData); -} - -function RequestLogin(){ - document.getElementById('loader').style.visibility="hidden"; - document.getElementById('loginpage').style.display='block'; -} - -function SubmitRequest (){ - document.getElementById('loginpage').style.display='none'; - var user = document.getElementById('login_user_text').value.trim(); - var password = document.getElementById('login_password_text').value.trim(); - var url = "/login?USER="+encodeURIComponent(user) + "&PASSWORD=" + encodeURIComponent(password) + "&SUBMIT=yes" ; - var xmlhttp = new XMLHttpRequest(); - xmlhttp.onreadystatechange = function() { - if (xmlhttp.readyState == 4 && xmlhttp.status != 200) { - RequestLogin(); - } - }; -xmlhttp.open("GET", url, true); -xmlhttp.send(); -} diff --git a/embedded/www/tool.html b/embedded/www/tool.html deleted file mode 100644 index 33c5cecd..00000000 --- a/embedded/www/tool.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - -
- V1.1 -    -
-
-

It seems you do not have any index.html neither index.html.gz, please upload it or update your firmware if necessary.

-
- -
-
Flash Filesystem
-
- -    -

-
-
- - - - - - - -
- - -
- + -
-
-
-
-
 
-
- - - - - - - - - - - -
TypeNameSize
-
- -
-
-
-
-
Firmware Update
-
- - - - - - - -
-
-
- - - - - - - - diff --git a/esp3d/GenLinkedList.h b/esp3d/GenLinkedList.h deleted file mode 100644 index f2051cec..00000000 --- a/esp3d/GenLinkedList.h +++ /dev/null @@ -1,340 +0,0 @@ -/* - GenLinkedList.h - V1.1 - Generic LinkedList implementation - Works better with FIFO, because LIFO will need to - search the entire List to find the last one; - - For instructions, go to https://github.com/ivanseidel/LinkedList - - Created by Ivan Seidel Gomes, March, 2013. - Released into the public domain. - Changelog: 2015/10/05: [Luc] Change false to NULL for pointers -*/ - - -#ifndef GenLinkedList_h -#define GenLinkedList_h - -template -struct ListNode { - T data; - ListNode *next; -}; - -template -class GenLinkedList -{ - -protected: - int _size; - ListNode *root; - ListNode *last; - - // Helps "get" method, by saving last position - ListNode *lastNodeGot; - int lastIndexGot; - // isCached should be set to FALSE - // every time the list suffer changes - bool isCached; - - ListNode* getNode(int index); - -public: - GenLinkedList(); - ~GenLinkedList(); - - /* - Returns current size of GenLinkedList - */ - virtual int size(); - /* - Adds a T object in the specified index; - Unlink and link the GenLinkedList correcly; - Increment _size - */ - virtual bool add(int index, T); - /* - Adds a T object in the end of the GenLinkedList; - Increment _size; - */ - virtual bool add(T); - /* - Adds a T object in the start of the GenLinkedList; - Increment _size; - */ - virtual bool unshift(T); - /* - Set the object at index, with T; - Increment _size; - */ - virtual bool set(int index, T); - /* - Remove object at index; - If index is not reachable, returns false; - else, decrement _size - */ - virtual T remove(int index); - /* - Remove last object; - */ - virtual T pop(); - /* - Remove first object; - */ - virtual T shift(); - /* - Get the index'th element on the list; - Return Element if accessible, - else, return false; - */ - virtual T get(int index); - - /* - Clear the entire array - */ - virtual void clear(); - -}; - -// Initialize GenLinkedList with false values -template -GenLinkedList::GenLinkedList() -{ - root=NULL; - last=NULL; - _size=0; - - lastNodeGot = root; - lastIndexGot = 0; - isCached = false; -} - -// Clear Nodes and free Memory -template -GenLinkedList::~GenLinkedList() -{ - ListNode* tmp; - while(root!=NULL) { - tmp=root; - root=root->next; - delete tmp; - } - last = NULL; - _size=0; - isCached = false; -} - -/* - Actually "logic" coding -*/ - -template -ListNode* GenLinkedList::getNode(int index) -{ - - int _pos = 0; - ListNode* current = root; - - // Check if the node trying to get is - // immediately AFTER the previous got one - if(isCached && lastIndexGot <= index) { - _pos = lastIndexGot; - current = lastNodeGot; - } - - while(_pos < index && current) { - current = current->next; - - _pos++; - } - - // Check if the object index got is the same as the required - if(_pos == index) { - isCached = true; - lastIndexGot = index; - lastNodeGot = current; - - return current; - } - - return NULL; -} - -template -int GenLinkedList::size() -{ - return _size; -} - -template -bool GenLinkedList::add(int index, T _t) -{ - - if(index >= _size) { - return add(_t); - } - - if(index == 0) { - return unshift(_t); - } - - ListNode *tmp = new ListNode(), - *_prev = getNode(index-1); - tmp->data = _t; - tmp->next = _prev->next; - _prev->next = tmp; - - _size++; - isCached = false; - - return true; -} - -template -bool GenLinkedList::add(T _t) -{ - - ListNode *tmp = new ListNode(); - tmp->data = _t; - tmp->next = NULL; - - if(root) { - // Already have elements inserted - last->next = tmp; - last = tmp; - } else { - // First element being inserted - root = tmp; - last = tmp; - } - - _size++; - isCached = false; - - return true; -} - -template -bool GenLinkedList::unshift(T _t) -{ - - if(_size == 0) { - return add(_t); - } - - ListNode *tmp = new ListNode(); - tmp->next = root; - tmp->data = _t; - root = tmp; - - _size++; - isCached = false; - - return true; -} - -template -bool GenLinkedList::set(int index, T _t) -{ - // Check if index position is in bounds - if(index < 0 || index >= _size) { - return false; - } - - getNode(index)->data = _t; - return true; -} - -template -T GenLinkedList::pop() -{ - if(_size <= 0) { - return T(); - } - - isCached = false; - - if(_size >= 2) { - ListNode *tmp = getNode(_size - 2); - T ret = tmp->next->data; - delete(tmp->next); - tmp->next = NULL; - last = tmp; - _size--; - return ret; - } else { - // Only one element left on the list - T ret = root->data; - delete(root); - root = NULL; - last = NULL; - _size = 0; - return ret; - } -} - -template -T GenLinkedList::shift() -{ - if(_size <= 0) { - return T(); - } - - if(_size > 1) { - ListNode *_next = root->next; - T ret = root->data; - delete(root); - root = _next; - _size --; - isCached = false; - - return ret; - } else { - // Only one left, then pop() - return pop(); - } - -} - -template -T GenLinkedList::remove(int index) -{ - if (index < 0 || index >= _size) { - return T(); - } - - if(index == 0) { - return shift(); - } - - if (index == _size-1) { - return pop(); - } - - ListNode *tmp = getNode(index - 1); - ListNode *toDelete = tmp->next; - T ret = toDelete->data; - tmp->next = tmp->next->next; - delete(toDelete); - _size--; - isCached = false; - return ret; -} - - -template -T GenLinkedList::get(int index) -{ - ListNode *tmp = getNode(index); - - return (tmp ? tmp->data : T()); -} - -template -void GenLinkedList::clear() -{ - while(size() > 0) { - shift(); - } -} - -#endif diff --git a/esp3d/bridge.cpp b/esp3d/bridge.cpp deleted file mode 100644 index 58d6d34d..00000000 --- a/esp3d/bridge.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/* - bridge.cpp - esp3d bridge serial/tcp class - - Copyright (c) 2014 Luc Lebosse. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "config.h" -#include "bridge.h" -#include "command.h" -#include "webinterface.h" - -#ifdef TCP_IP_DATA_FEATURE -WiFiServer * data_server; -WiFiClient serverClients[MAX_SRV_CLIENTS]; -#endif - -bool BRIDGE::header_sent = false; -String BRIDGE::buffer_web = ""; -void BRIDGE::print (const __FlashStringHelper *data, tpipe output) -{ - String tmp = data; - BRIDGE::print(tmp.c_str(), output); -} -void BRIDGE::print (String & data, tpipe output) -{ - BRIDGE::print(data.c_str(), output); -} -void BRIDGE::print (const char * data, tpipe output) -{ - switch(output) { - case SERIAL_PIPE: - header_sent = false; - ESP_SERIAL_OUT.print(data); - break; -#ifdef TCP_IP_DATA_FEATURE - case TCP_PIPE: - header_sent = false; - BRIDGE::send2TCP(data); - break; -#endif - case WEB_PIPE: - if (!header_sent) { - web_interface->web_server.setContentLength(CONTENT_LENGTH_UNKNOWN); - web_interface->web_server.sendHeader("Content-Type","text/html"); - web_interface->web_server.sendHeader("Cache-Control","no-cache"); - web_interface->web_server.send(200); - header_sent = true; - } - buffer_web+=data; - if (buffer_web.length() > 1200) { - //send data - web_interface->web_server.sendContent(buffer_web); - //reset buffer - buffer_web=""; - } - break; - default: - break; - } -} -void BRIDGE::println (const __FlashStringHelper *data, tpipe output) -{ - BRIDGE::print(data,output); -#ifdef TCP_IP_DATA_FEATURE - BRIDGE::print("\r",output); -#endif - BRIDGE::print("\n",output); -} -void BRIDGE::println (String & data, tpipe output) -{ - BRIDGE::print(data,output); -#ifdef TCP_IP_DATA_FEATURE - BRIDGE::print("\r",output); -#endif - BRIDGE::print("\n",output); -} -void BRIDGE::println (const char * data, tpipe output) -{ - BRIDGE::print(data,output); -#ifdef TCP_IP_DATA_FEATURE - BRIDGE::print("\r",output); -#endif - BRIDGE::print("\n",output); -} -void BRIDGE::flush (tpipe output) -{ - switch(output) { - case SERIAL_PIPE: - ESP_SERIAL_OUT.flush(); - break; -#ifdef TCP_IP_DATA_FEATURE - case TCP_PIPE: - break; -#endif - case WEB_PIPE: - if(header_sent) { - //send data - web_interface->web_server.sendContent(buffer_web); - //close line - web_interface->web_server.sendContent(""); - } - break; - default: - break; - } - header_sent = false; - buffer_web = String(); -} - - -#ifdef TCP_IP_DATA_FEATURE -void BRIDGE::send2TCP(const __FlashStringHelper *data) -{ - String tmp = data; - BRIDGE::send2TCP(tmp.c_str()); -} -void BRIDGE::send2TCP(String data) -{ - BRIDGE::send2TCP(data.c_str()); -} -void BRIDGE::send2TCP(const char * data) -{ - for(uint8_t i = 0; i < MAX_SRV_CLIENTS; i++) { - if (serverClients[i] && serverClients[i].connected()) { - serverClients[i].write(data, strlen(data)); - delay(0); - } - } -} -#endif - -bool BRIDGE::processFromSerial2TCP() -{ - uint8_t i; - //check UART for data - if(ESP_SERIAL_OUT.available()) { - size_t len = ESP_SERIAL_OUT.available(); - uint8_t sbuf[len]; - ESP_SERIAL_OUT.readBytes(sbuf, len); -#ifdef TCP_IP_DATA_FEATURE - if (WiFi.getMode()!=WIFI_OFF ) { - //push UART data to all connected tcp clients - for(i = 0; i < MAX_SRV_CLIENTS; i++) { - if (serverClients[i] && serverClients[i].connected()) { - serverClients[i].write(sbuf, len); - delay(0); - } - } - } -#endif - //process data if any - COMMAND::read_buffer_serial(sbuf, len); - return true; - } else { - return false; - } -} -#ifdef TCP_IP_DATA_FEATURE -void BRIDGE::processFromTCP2Serial() -{ - uint8_t i,data; - //check if there are any new clients - if (data_server->hasClient()) { - for(i = 0; i < MAX_SRV_CLIENTS; i++) { - //find free/disconnected spot - if (!serverClients[i] || !serverClients[i].connected()) { - if(serverClients[i]) { - serverClients[i].stop(); - } - serverClients[i] = data_server->available(); - continue; - } - } - //no free/disconnected spot so reject - WiFiClient serverClient = data_server->available(); - serverClient.stop(); - } - //check clients for data - //to avoid any pollution if Uploading file to SDCard - if ((web_interface->blockserial) == false) { - for(i = 0; i < MAX_SRV_CLIENTS; i++) { - if (serverClients[i] && serverClients[i].connected()) { - if(serverClients[i].available()) { - //get data from the tcp client and push it to the UART - while(serverClients[i].available()) { - data = serverClients[i].read(); - ESP_SERIAL_OUT.write(data); - COMMAND::read_buffer_tcp(data); - } - } - } - } - } -} -#endif diff --git a/esp3d/bridge.h b/esp3d/bridge.h deleted file mode 100644 index 6bff0f8f..00000000 --- a/esp3d/bridge.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - bridge.h - esp3d bridge serial/tcp class - - Copyright (c) 2014 Luc Lebosse. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef BRIDGE_H -#define BRIDGE_H -#include -#include "config.h" -#ifdef TCP_IP_DATA_FEATURE -extern WiFiServer * data_server; -#endif - -class BRIDGE -{ -public: - static bool header_sent; - static String buffer_web; - static bool processFromSerial2TCP(); - static void print (const __FlashStringHelper *data, tpipe output); - static void print (String & data, tpipe output); - static void print (const char * data, tpipe output); - static void println (const __FlashStringHelper *data, tpipe output); - static void println (String & data, tpipe output); - static void println (const char * data, tpipe output); - static void flush (tpipe output); -#ifdef TCP_IP_DATA_FEATURE - static void processFromTCP2Serial(); - static void send2TCP(const __FlashStringHelper *data); - static void send2TCP(String data); - static void send2TCP(const char * data); -#endif -}; -#endif diff --git a/esp3d/command.cpp b/esp3d/command.cpp deleted file mode 100644 index 9b86fe72..00000000 --- a/esp3d/command.cpp +++ /dev/null @@ -1,1600 +0,0 @@ -/* - command.cpp - ESP3D configuration class - - Copyright (c) 2014 Luc Lebosse. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ -#include "config.h" -#include "command.h" -#include "wificonf.h" -#include "webinterface.h" -#ifndef FS_NO_GLOBALS -#define FS_NO_GLOBALS -#endif -#include -#if defined(ARDUINO_ARCH_ESP32) -#include "SPIFFS.h" -#define MAX_GPIO 16 -#else -#define MAX_GPIO 37 -#endif -String COMMAND::buffer_serial; -String COMMAND::buffer_tcp; - -#define ERROR_CMD_MSG (output == WEB_PIPE)?F("Error: Wrong Command"):F("M117 Cmd Error") -#define INCORRECT_CMD_MSG (output == WEB_PIPE)?F("Error: Incorrect Command"):F("M117 Incorrect Cmd") -#define OK_CMD_MSG (output == WEB_PIPE)?F("ok"):F("M117 Cmd Ok") - -String COMMAND::get_param(String & cmd_params, const char * id, bool withspace) -{ - static String parameter; - String sid=id; - int start; - int end = -1; - parameter = ""; - //if no id it means it is first part of cmd - if (strlen(id) == 0) { - start = 0; - } - //else find id position - else { - start = cmd_params.indexOf(id); - } - //if no id found and not first part leave - if (start == -1 ) { - return parameter; - } - //password and SSID can have space so handle it - //if no space expected use space as delimiter - if (!withspace) { - end = cmd_params.indexOf(" ",start); - } -#ifdef AUTHENTICATION_FEATURE - //if space expected only one parameter but additional password may be present - else if (sid != " pwd=") { - end = cmd_params.indexOf(" pwd=",start); - } -#endif - //if no end found - take all - if (end == -1) { - end = cmd_params.length(); - } - //extract parameter - parameter = cmd_params.substring(start+strlen(id),end); - //be sure no extra space - parameter.trim(); - return parameter; -} -#ifdef AUTHENTICATION_FEATURE -//check admin password -bool COMMAND::isadmin(String & cmd_params) -{ - String adminpassword; - String sadminPassword; - if (!CONFIG::read_string(EP_ADMIN_PWD, sadminPassword, MAX_LOCAL_PASSWORD_LENGTH)) { - LOG("ERROR getting admin\r\n") - sadminPassword=FPSTR(DEFAULT_ADMIN_PWD); - } - adminpassword = get_param(cmd_params,"pwd=", true); - if (!sadminPassword.equals(adminpassword)) { - LOG("Not identified from command line\r\n") - return false; - } else { - return true; - } -} -//check user password - admin password is also valid -bool COMMAND::isuser(String & cmd_params) -{ - String userpassword; - String suserPassword; - if (!CONFIG::read_string(EP_USER_PWD, suserPassword, MAX_LOCAL_PASSWORD_LENGTH)) { - LOG("ERROR getting user\r\n") - suserPassword=FPSTR(DEFAULT_USER_PWD); - } - userpassword = get_param(cmd_params,"pwd=", true); - //it is not user password - if (!suserPassword.equals(userpassword)) { - //check admin password - return COMMAND::isadmin(cmd_params); - } else { - return true; - } -} -#endif -bool COMMAND::execute_command(int cmd,String cmd_params, tpipe output, level_authenticate_type auth_level) -{ - bool response = true; - level_authenticate_type auth_type = auth_level; -#ifdef AUTHENTICATION_FEATURE - if (isadmin(cmd_params)) { - auth_type = LEVEL_ADMIN; - LOG("admin identified\r\n"); - } - if (isuser(cmd_params) && (auth_type != LEVEL_ADMIN)) { - auth_type = LEVEL_USER; - LOG("user identified\r\n"); - } -#ifdef DEBUG_ESP3D - if ( auth_type == LEVEL_ADMIN) - { - LOG("admin identified\r\n"); - } - else { - if( auth_type == LEVEL_USER) - { - LOG("user identified\r\n"); - } - else - { - LOG("guest identified\r\n"); - } - } -#endif -#endif - //manage parameters - byte mode = 254; - String parameter; - LOG("Execute Command\r\n") - switch(cmd) { - //STA SSID - //[ESP100][pwd=] - case 100: - parameter = get_param(cmd_params,"", true); - if (!CONFIG::isSSIDValid(parameter.c_str())) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - } -#ifdef AUTHENTICATION_FEATURE - if (auth_type != LEVEL_ADMIN) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - } else -#endif - if(!CONFIG::write_string(EP_STA_SSID,parameter.c_str())) { - BRIDGE::println(ERROR_CMD_MSG, output); - response = false; - } else { - BRIDGE::println(OK_CMD_MSG, output); - } - break; - //STA Password - //[ESP101][pwd=] - case 101: - parameter = get_param(cmd_params,"", true); - if (!CONFIG::isPasswordValid(parameter.c_str())) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } -#ifdef AUTHENTICATION_FEATURE - if (auth_type != LEVEL_ADMIN) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else -#endif - if(!CONFIG::write_string(EP_STA_PASSWORD,parameter.c_str())) { - BRIDGE::println(ERROR_CMD_MSG, output); - response = false; - } else { - BRIDGE::println(OK_CMD_MSG, output); - } - break; - //Hostname - //[ESP102][pwd=] - case 102: - parameter = get_param(cmd_params,"", true); - if (!CONFIG::isHostnameValid(parameter.c_str())) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } -#ifdef AUTHENTICATION_FEATURE - if (auth_type != LEVEL_ADMIN) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else -#endif - if(!CONFIG::write_string(EP_HOSTNAME,parameter.c_str())) { - BRIDGE::println(ERROR_CMD_MSG, output); - response = false; - } else { - BRIDGE::println(OK_CMD_MSG, output); - } - break; - //Wifi mode (STA/AP) - //[ESP103][pwd=] - case 103: - parameter = get_param(cmd_params,"", true); - if (parameter == "STA") { - mode = CLIENT_MODE; - } else if (parameter == "AP") { - mode = AP_MODE; - } else { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } - if ((mode == CLIENT_MODE) || (mode == AP_MODE)) { -#ifdef AUTHENTICATION_FEATURE - if (auth_type != LEVEL_ADMIN) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else -#endif - if(!CONFIG::write_byte(EP_WIFI_MODE,mode)) { - BRIDGE::println(ERROR_CMD_MSG, output); - response = false; - } else { - BRIDGE::println(OK_CMD_MSG, output); - } - } - break; - //STA IP mode (DHCP/STATIC) - //[ESP104][pwd=] - case 104: - parameter = get_param(cmd_params,"", true); - if (parameter == "STATIC") { - mode = STATIC_IP_MODE; - } else if (parameter == "DHCP") { - mode = DHCP_MODE; - } else { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } - if ((mode == STATIC_IP_MODE) || (mode == DHCP_MODE)) { -#ifdef AUTHENTICATION_FEATURE - if (auth_type != LEVEL_ADMIN) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else -#endif - if(!CONFIG::write_byte(EP_STA_IP_MODE,mode)) { - BRIDGE::println(ERROR_CMD_MSG, output); - response = false; - } else { - BRIDGE::println(OK_CMD_MSG, output); - } - } - break; - //AP SSID - //[ESP105][pwd=] - case 105: - parameter = get_param(cmd_params,"", true); - if (!CONFIG::isSSIDValid(parameter.c_str())) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } -#ifdef AUTHENTICATION_FEATURE - if (auth_type != LEVEL_ADMIN) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else -#endif - if(!CONFIG::write_string(EP_AP_SSID,parameter.c_str())) { - BRIDGE::println(ERROR_CMD_MSG, output); - response = false; - } else { - BRIDGE::println(OK_CMD_MSG, output); - } - break; - //AP Password - //[ESP106][pwd=] - case 106: - parameter = get_param(cmd_params,"", true); - if (!CONFIG::isPasswordValid(parameter.c_str())) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } -#ifdef AUTHENTICATION_FEATURE - if (auth_type != LEVEL_ADMIN) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else -#endif - if(!CONFIG::write_string(EP_AP_PASSWORD,parameter.c_str())) { - BRIDGE::println(ERROR_CMD_MSG, output); - response = false; - } else { - BRIDGE::println(OK_CMD_MSG, output); - } - break; - //AP IP mode (DHCP/STATIC) - //[ESP107][pwd=] - case 107: - parameter = get_param(cmd_params,"", true); - if (parameter == "STATIC") { - mode = STATIC_IP_MODE; - } else if (parameter == "DHCP") { - mode = DHCP_MODE; - } else { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } - if ((mode == STATIC_IP_MODE) || (mode == DHCP_MODE)) { -#ifdef AUTHENTICATION_FEATURE - if (auth_type != LEVEL_ADMIN) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else -#endif - if(!CONFIG::write_byte(EP_AP_IP_MODE,mode)) { - BRIDGE::println(ERROR_CMD_MSG, output); - response = false; - } else { - BRIDGE::println(OK_CMD_MSG, output); - } - } - break; - // Set wifi on/off - //[ESP110][pwd=] - case 110: - parameter = get_param(cmd_params,"", true); - if (parameter == "on") { - mode = 1; - } else if (parameter == "off") { - mode = 0; - } else if (parameter == "restart") { - mode = 2; - } else { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } - if (response) { - #ifdef AUTHENTICATION_FEATURE - if (auth_type != LEVEL_ADMIN) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else - #endif - if (mode == 0) { - if (WiFi.getMode() !=WIFI_OFF) { - //disable wifi - ESP_SERIAL_OUT.println("M117 Disabling Wifi"); - WiFi.mode(WIFI_OFF); - wifi_config.Disable_servers(); - return response; - } else BRIDGE::println("M117 Wifi already off", output); - } - else if (mode == 1) { //restart device is the best way to start everything clean - if (WiFi.getMode() == WIFI_OFF) { - ESP_SERIAL_OUT.println("M117 Enabling Wifi"); - CONFIG::esp_restart(); - } else BRIDGE::println("M117 Wifi already on", output); - } else { //restart wifi and restart is the best way to start everything clean - ESP_SERIAL_OUT.println("M117 Enabling Wifi"); - CONFIG::esp_restart(); - } - } - break; - //Get current IP - //[ESP111]
- case 111: { - String currentIP ; - if (WiFi.getMode()==WIFI_STA) { - currentIP=WiFi.localIP().toString(); - } else { - currentIP=WiFi.softAPIP().toString(); - } - BRIDGE::print(cmd_params, output); - BRIDGE::println(currentIP, output); - LOG(cmd_params) - LOG(currentIP) - LOG("\r\n") - } - break; - //Get hostname - //[ESP112]
- case 112: { - String shost ; - if (!CONFIG::read_string(EP_HOSTNAME, shost, MAX_HOSTNAME_LENGTH)) { - shost=wifi_config.get_default_hostname(); - } - BRIDGE::print(cmd_params, output); - BRIDGE::println(shost, output); - LOG(cmd_params) - LOG(shost) - LOG("\r\n") - } - break; -#ifdef DIRECT_PIN_FEATURE - //Get/Set pin value - //[ESP201]P V [PULLUP=YES RAW=YES]pwd= - case 201: - parameter = get_param(cmd_params,"", true); -#ifdef AUTHENTICATION_FEATURE - if (auth_type == LEVEL_GUEST) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else -#endif - { - //check if have pin - parameter = get_param(cmd_params,"P", false); - LOG("Pin:") - LOG(parameter) - LOG("\r\n") - if (parameter == "") { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else { - int pin = parameter.toInt(); - //check pin is valid and not serial used pins - if ((pin >= 0) && (pin <= 16) && !((pin == 1) || (pin == 3))) { - //check if is set or get - parameter = get_param(cmd_params,"V", false); - //it is a get - if (parameter == "") { - //this is to not set pin mode - parameter = get_param(cmd_params,"RAW=", false); - if (parameter !="YES") { - parameter = get_param(cmd_params,"PULLUP=", false); - if (parameter == "YES") { - //GPIO16 is different than others - if (pin < MAX_GPIO) { - LOG("Set as input pull up\r\n") - pinMode(pin, INPUT_PULLUP); - } -#ifdef ARDUINO_ARCH_ESP8266 - else { - LOG("Set as input pull down 16\r\n") - pinMode(pin, INPUT_PULLDOWN_16); - } -#endif - } else { - LOG("Set as input\r\n") - pinMode(pin, INPUT); - } - delay(100); - } - int value = digitalRead(pin); - LOG("Read:"); - LOG(String(value).c_str()) - LOG("\n"); - BRIDGE::println(String(value).c_str(), output); - } else { - //it is a set - int value = parameter.toInt(); - //verify it is a 0 or a 1 - if ((value == 0) || (value == 1)) { - pinMode(pin, OUTPUT); - delay(10); - LOG("Set:") - LOG(String((value == 0)?LOW:HIGH)) - LOG("\r\n") - digitalWrite(pin, (value == 0)?LOW:HIGH); - BRIDGE::println(OK_CMD_MSG, output); - } else { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } - } - } else { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } - } - } - break; -#endif - - //Save data string - //[ESP300]pwd= - case 300: - parameter = get_param(cmd_params,"", true); -#ifdef AUTHENTICATION_FEATURE - if (auth_type == LEVEL_GUEST) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else -#endif - { - if(!CONFIG::write_string(EP_DATA_STRING,parameter.c_str())) { - BRIDGE::println(ERROR_CMD_MSG, output); - response = false; - } else { - BRIDGE::println(OK_CMD_MSG, output); - } - } - break; - //get data string - //[ESP301] pwd= - case 301: - parameter = get_param(cmd_params,"", true); -#ifdef AUTHENTICATION_FEATURE - if (auth_type == LEVEL_GUEST) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else -#endif - { - char sbuf[MAX_DATA_LENGTH+1]; - if (CONFIG::read_string(EP_DATA_STRING, sbuf, MAX_DATA_LENGTH)) { - BRIDGE::println(sbuf, output); - } else { - BRIDGE::println(F("Error reading data"), output); - } - } - break; - //Get full EEPROM settings content - //[ESP400] - case 400: { - char sbuf[MAX_DATA_LENGTH+1]; - uint8_t ipbuf[4]; - byte bbuf=0; - int ibuf=0; - parameter = get_param(cmd_params,"", true); - delay(0); - //Start JSON - BRIDGE::println(F("{\"EEPROM\":["), output); - if (cmd_params == "network" || cmd_params == "") { - - //1- Baud Rate - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_BAUD_RATE), output); - BRIDGE::print(F("\",\"T\":\"I\",\"V\":\""), output); - if (!CONFIG::read_buffer(EP_BAUD_RATE, (byte *)&ibuf, INTEGER_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(ibuf), output); - } - BRIDGE::print(F("\",\"H\":\"Baud Rate\",\"O\":[{\"9600\":\"9600\"},{\"19200\":\"19200\"},{\"38400\":\"38400\"},{\"57600\":\"57600\"},{\"115200\":\"115200\"},{\"230400\":\"230400\"},{\"250000\":\"250000\"}]}"), output); - BRIDGE::println(F(","), output); - - //2-Sleep Mode - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_SLEEP_MODE), output); - BRIDGE::print(F("\",\"T\":\"B\",\"V\":\""), output); - if (!CONFIG::read_byte(EP_SLEEP_MODE, &bbuf )) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(bbuf), output); - } - BRIDGE::print(F("\",\"H\":\"Sleep Mode\",\"O\":[{\"None\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(WIFI_NONE_SLEEP), output); -#ifdef ARDUINO_ARCH_ESP8266 - BRIDGE::print(F("\"},{\"Light\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(WIFI_LIGHT_SLEEP), output); -#endif - BRIDGE::print(F("\"},{\"Modem\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(WIFI_MODEM_SLEEP), output); - BRIDGE::print(F("\"}]}"), output); - BRIDGE::println(F(","), output); - - //3-Web Port - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_WEB_PORT), output); - BRIDGE::print(F("\",\"T\":\"I\",\"V\":\""), output); - if (!CONFIG::read_buffer(EP_WEB_PORT, (byte *)&ibuf, INTEGER_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(ibuf), output); - } - BRIDGE::print(F("\",\"H\":\"Web Port\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MAX_WEB_PORT), output); - BRIDGE::print(F("\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MIN_WEB_PORT), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); - - //4-Data Port - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_DATA_PORT), output); - BRIDGE::print(F("\",\"T\":\"I\",\"V\":\""), output); - if (!CONFIG::read_buffer(EP_DATA_PORT, (byte *)&ibuf, INTEGER_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(ibuf), output); - } - BRIDGE::print(F("\",\"H\":\"Data Port\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MAX_DATA_PORT), output); - BRIDGE::print(F("\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MIN_DATA_PORT), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); -#ifdef AUTHENTICATION_FEATURE - //5-Admin password - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_ADMIN_PWD), output); - BRIDGE::print(F("\",\"T\":\"S\",\"V\":\""), output); - if (!CONFIG::read_string(EP_ADMIN_PWD, sbuf, MAX_LOCAL_PASSWORD_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print("********", output); - } - BRIDGE::print(F("\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MAX_LOCAL_PASSWORD_LENGTH), output); - BRIDGE::print(F("\",\"H\":\"Admin Password\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MIN_LOCAL_PASSWORD_LENGTH), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); - - //6-User password - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_USER_PWD), output); - BRIDGE::print(F("\",\"T\":\"S\",\"V\":\""), output); - if (!CONFIG::read_string(EP_USER_PWD, sbuf, MAX_LOCAL_PASSWORD_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print("********", output); - } - BRIDGE::print(F("\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MAX_LOCAL_PASSWORD_LENGTH), output); - BRIDGE::print(F("\",\"H\":\"User Password\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MIN_LOCAL_PASSWORD_LENGTH), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); -#endif - //7-Hostname - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_HOSTNAME), output); - BRIDGE::print(F("\",\"T\":\"S\",\"V\":\""), output); - if (!CONFIG::read_string(EP_HOSTNAME, sbuf, MAX_HOSTNAME_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print(sbuf, output); - } - BRIDGE::print(F("\",\"H\":\"Hostname\" ,\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MAX_HOSTNAME_LENGTH), output); - BRIDGE::print(F("\", \"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MIN_HOSTNAME_LENGTH), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); - - //8-wifi mode - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_WIFI_MODE), output); - BRIDGE::print(F("\",\"T\":\"B\",\"V\":\""), output); - if (!CONFIG::read_byte(EP_WIFI_MODE, &bbuf )) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(bbuf), output); - } - BRIDGE::print(F("\",\"H\":\"Wifi mode\",\"O\":[{\"AP\":\"1\"},{\"STA\":\"2\"}]}"), output); - BRIDGE::println(F(","), output); - - //9-STA SSID - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_STA_SSID), output); - BRIDGE::print(F("\",\"T\":\"S\",\"V\":\""), output); - if (!CONFIG::read_string(EP_STA_SSID, sbuf, MAX_SSID_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print(sbuf, output); - } - BRIDGE::print(F("\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MAX_SSID_LENGTH), output); - BRIDGE::print(F("\",\"H\":\"Station SSID\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MIN_SSID_LENGTH), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); - - //10-STA password - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_STA_PASSWORD), output); - BRIDGE::print(F("\",\"T\":\"S\",\"V\":\""), output); - if (!CONFIG::read_string(EP_STA_PASSWORD, sbuf, MAX_PASSWORD_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print("********", output); - } - BRIDGE::print(F("\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MAX_PASSWORD_LENGTH), output); - BRIDGE::print(F("\",\"H\":\"Station Password\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MIN_PASSWORD_LENGTH), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); - - //11-Station Network Mode - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_STA_PHY_MODE), output); - BRIDGE::print(F("\",\"T\":\"B\",\"V\":\""), output); - if (!CONFIG::read_byte(EP_STA_PHY_MODE, &bbuf )) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(bbuf), output); - } - BRIDGE::print(F("\",\"H\":\"Station Network Mode\",\"O\":[{\"11b\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(WIFI_PHY_MODE_11B), output); - BRIDGE::print(F("\"},{\"11g\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(WIFI_PHY_MODE_11G), output); - BRIDGE::print(F("\"},{\"11n\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(WIFI_PHY_MODE_11N), output); - BRIDGE::print(F("\"}]}"), output); - BRIDGE::println(F(","), output); - - //12-STA IP mode - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_STA_IP_MODE), output); - BRIDGE::print(F("\",\"T\":\"B\",\"V\":\""), output); - if (!CONFIG::read_byte(EP_STA_IP_MODE, &bbuf )) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(bbuf), output); - } - BRIDGE::print(F("\",\"H\":\"Station IP Mode\",\"O\":[{\"DHCP\":\"1\"},{\"Static\":\"2\"}]}"), output); - BRIDGE::println(F(","), output); - - //13-STA static IP - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_STA_IP_VALUE), output); - BRIDGE::print(F("\",\"T\":\"A\",\"V\":\""), output); - if (!CONFIG::read_buffer(EP_STA_IP_VALUE,(byte *)ipbuf, IP_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print(IPAddress(ipbuf).toString().c_str(), output); - } - BRIDGE::print(F("\",\"H\":\"Station Static IP\"}"), output); - BRIDGE::println(F(","), output); - - //14-STA static Mask - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_STA_MASK_VALUE), output); - BRIDGE::print(F("\",\"T\":\"A\",\"V\":\""), output); - if (!CONFIG::read_buffer(EP_STA_MASK_VALUE,(byte *)ipbuf, IP_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print(IPAddress(ipbuf).toString().c_str(), output); - } - BRIDGE::print(F("\",\"H\":\"Station Static Mask\"}"), output); - BRIDGE::println(F(","), output); - - //15-STA static Gateway - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_STA_GATEWAY_VALUE), output); - BRIDGE::print(F("\",\"T\":\"A\",\"V\":\""), output); - if (!CONFIG::read_buffer(EP_STA_GATEWAY_VALUE,(byte *)ipbuf, IP_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print(IPAddress(ipbuf).toString().c_str(), output); - } - BRIDGE::print(F("\",\"H\":\"Station Static Gateway\"}"), output); - BRIDGE::println(F(","), output); - - //16-AP SSID - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_AP_SSID), output); - BRIDGE::print(F("\",\"T\":\"S\",\"V\":\""), output); - if (!CONFIG::read_string(EP_AP_SSID, sbuf, MAX_SSID_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print(sbuf, output); - } - BRIDGE::print(F("\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MAX_SSID_LENGTH), output); - BRIDGE::print(F("\",\"H\":\"AP SSID\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MIN_SSID_LENGTH), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); - - //17-AP password - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_AP_PASSWORD), output); - BRIDGE::print(F("\",\"T\":\"S\",\"V\":\""), output); - if (!CONFIG::read_string(EP_AP_PASSWORD, sbuf, MAX_PASSWORD_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print("********", output); - } - BRIDGE::print(F("\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MAX_PASSWORD_LENGTH), output); - BRIDGE::print(F("\",\"H\":\"AP Password\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MIN_PASSWORD_LENGTH), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); - - //18 - AP Network Mode - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_AP_PHY_MODE), output); - BRIDGE::print(F("\",\"T\":\"B\",\"V\":\""), output); - if (!CONFIG::read_byte(EP_AP_PHY_MODE, &bbuf )) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(bbuf), output); - } - BRIDGE::print(F("\",\"H\":\"AP Network Mode\",\"O\":[{\"11b\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(WIFI_PHY_MODE_11B), output); - BRIDGE::print(F("\"},{\"11g\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(WIFI_PHY_MODE_11G), output); - BRIDGE::print(F("\"}]}"), output); - BRIDGE::println(F(","), output); - - //19-AP SSID visibility - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_SSID_VISIBLE), output); - BRIDGE::print(F("\",\"T\":\"B\",\"V\":\""), output); - if (!CONFIG::read_byte(EP_SSID_VISIBLE, &bbuf )) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(bbuf), output); - } - BRIDGE::print(F("\",\"H\":\"SSID Visible\",\"O\":[{\"No\":\"0\"},{\"Yes\":\"1\"}]}"), output); - BRIDGE::println(F(","), output); - - //20-AP Channel - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_CHANNEL), output); - BRIDGE::print(F("\",\"T\":\"B\",\"V\":\""), output); - if (!CONFIG::read_byte(EP_CHANNEL, &bbuf )) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(bbuf), output); - } - BRIDGE::print(F("\",\"H\":\"AP Channel\",\"O\":["), output); - for (int i=1; i < 12 ; i++) { - BRIDGE::print(F("{\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(i), output); - BRIDGE::print(F("\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(i), output); - BRIDGE::print(F("\"}"), output); - if (i<11) { - BRIDGE::print(F(","), output); - } - } - BRIDGE::print(F("]}"), output); - BRIDGE::println(F(","), output); - - //21-AP Authentication - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_AUTH_TYPE), output); - BRIDGE::print(F("\",\"T\":\"B\",\"V\":\""), output); - if (!CONFIG::read_byte(EP_AUTH_TYPE, &bbuf )) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(bbuf), output); - } - BRIDGE::print(F("\",\"H\":\"Authentication\",\"O\":[{\"Open\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(AUTH_OPEN), output); - BRIDGE::print(F("\"},{\"WPA\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(AUTH_WPA_PSK), output); - BRIDGE::print(F("\"},{\"WPA2\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(AUTH_WPA2_PSK), output); - BRIDGE::print(F("\"},{\"WPA/WPA2\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(AUTH_WPA_WPA2_PSK), output); - BRIDGE::print(F("\"}]}"), output); - BRIDGE::println(F(","), output); - - //22-AP IP mode - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_AP_IP_MODE), output); - BRIDGE::print(F("\",\"T\":\"B\",\"V\":\""), output); - if (!CONFIG::read_byte(EP_AP_IP_MODE, &bbuf )) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(bbuf), output); - } - BRIDGE::print(F("\",\"H\":\"AP IP Mode\",\"O\":[{\"DHCP\":\"1\"},{\"Static\":\"2\"}]}"), output); - BRIDGE::println(F(","), output); - - //23-AP static IP - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_AP_IP_VALUE), output); - BRIDGE::print(F("\",\"T\":\"A\",\"V\":\""), output); - if (!CONFIG::read_buffer(EP_AP_IP_VALUE,(byte *)ipbuf, IP_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print(IPAddress(ipbuf).toString().c_str(), output); - } - BRIDGE::print(F("\",\"H\":\"AP Static IP\"}"), output); - BRIDGE::println(F(","), output); - - //24-AP static Mask - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_AP_MASK_VALUE), output); - BRIDGE::print(F("\",\"T\":\"A\",\"V\":\""), output); - if (!CONFIG::read_buffer(EP_AP_MASK_VALUE,(byte *)ipbuf, IP_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print(IPAddress(ipbuf).toString().c_str(), output); - } - BRIDGE::print(F("\",\"H\":\"AP Static Mask\"}"), output); - BRIDGE::println(F(","), output); - - //25-AP static Gateway - BRIDGE::print(F("{\"F\":\"network\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_AP_GATEWAY_VALUE), output); - BRIDGE::print(F("\",\"T\":\"A\",\"V\":\""), output); - if (!CONFIG::read_buffer(EP_AP_GATEWAY_VALUE,(byte *)ipbuf, IP_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print(IPAddress(ipbuf).toString().c_str(), output); - } - BRIDGE::print(F("\",\"H\":\"AP Static Gateway\"}"), output); - delay(0); - } - - if (cmd_params == "printer" || cmd_params == "") { - if (cmd_params == "") { - BRIDGE::println(F(","), output); - } - //Target FW - BRIDGE::print(F("{\"F\":\"printer\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_TARGET_FW), output); - BRIDGE::print(F("\",\"T\":\"B\",\"V\":\""), output); - if (!CONFIG::read_byte(EP_TARGET_FW, &bbuf )) { - BRIDGE::print("Unknown", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(bbuf), output); - } - BRIDGE::print(F("\",\"H\":\"Target FW\",\"O\":[{\"Repetier\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(REPETIER), output); - BRIDGE::print(F("\"},{\"Repetier for Davinci\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(REPETIER4DV), output); - BRIDGE::print(F("\"},{\"Marlin\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MARLIN), output); - BRIDGE::print(F("\"},{\"Marlin Kimbra\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MARLINKIMBRA), output); - BRIDGE::print(F("\"},{\"Smoothieware\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(SMOOTHIEWARE), output); - BRIDGE::print(F("\"},{\"Unknown\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(UNKNOWN_FW), output); - BRIDGE::print(F("\"}]}"), output); - BRIDGE::println(F(","), output); - - //Refresh time 1 - BRIDGE::print(F("{\"F\":\"printer\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_REFRESH_PAGE_TIME), output); - BRIDGE::print(F("\",\"T\":\"B\",\"V\":\""), output); - if (!CONFIG::read_byte(EP_REFRESH_PAGE_TIME, &bbuf )) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(bbuf), output); - } - BRIDGE::print(F("\",\"H\":\"Temperature Refresh Time\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MAX_REFRESH), output); - BRIDGE::print(F("\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MIN_REFRESH), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); - - //Refresh time 2 - BRIDGE::print(F("{\"F\":\"printer\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_REFRESH_PAGE_TIME2), output); - BRIDGE::print(F("\",\"T\":\"B\",\"V\":\""), output); - if (!CONFIG::read_byte(EP_REFRESH_PAGE_TIME2, &bbuf )) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(bbuf), output); - } - BRIDGE::print(F("\",\"H\":\"Position Refresh Time\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MAX_REFRESH), output); - BRIDGE::print(F("\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MIN_REFRESH), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); - - //XY feedrate - BRIDGE::print(F("{\"F\":\"printer\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_XY_FEEDRATE), output); - BRIDGE::print(F("\",\"T\":\"I\",\"V\":\""), output); - if (!CONFIG::read_buffer(EP_XY_FEEDRATE, (byte *)&ibuf, INTEGER_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(ibuf), output); - } - BRIDGE::print(F("\",\"H\":\"XY feedrate\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MAX_XY_FEEDRATE), output); - BRIDGE::print(F("\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MIN_XY_FEEDRATE), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); - - //Z feedrate - BRIDGE::print(F("{\"F\":\"printer\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_Z_FEEDRATE), output); - BRIDGE::print(F("\",\"T\":\"I\",\"V\":\""), output); - if (!CONFIG::read_buffer(EP_Z_FEEDRATE, (byte *)&ibuf, INTEGER_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(ibuf), output); - } - BRIDGE::print(F("\",\"H\":\"Z feedrate\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MAX_Z_FEEDRATE), output); - BRIDGE::print(F("\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MIN_Z_FEEDRATE), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); - - //E feedrate - BRIDGE::print(F("{\"F\":\"printer\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_E_FEEDRATE), output); - BRIDGE::print(F("\",\"T\":\"I\",\"V\":\""), output); - if (!CONFIG::read_buffer(EP_E_FEEDRATE, (byte *)&ibuf, INTEGER_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print((const char *)CONFIG::intTostr(ibuf), output); - } - BRIDGE::print(F("\",\"H\":\"E feedrate\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MAX_E_FEEDRATE), output); - BRIDGE::print(F("\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(DEFAULT_MIN_E_FEEDRATE), output); - BRIDGE::print(F("\"}"), output); - BRIDGE::println(F(","), output); - - //Camera address, data string - BRIDGE::print(F("{\"F\":\"printer\",\"P\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(EP_DATA_STRING), output); - BRIDGE::print(F("\",\"T\":\"S\",\"V\":\""), output); - if (!CONFIG::read_string(EP_DATA_STRING, sbuf, MAX_DATA_LENGTH)) { - BRIDGE::print("???", output); - } else { - BRIDGE::print(sbuf, output); - } - BRIDGE::print(F("\",\"S\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MAX_DATA_LENGTH), output); - BRIDGE::print(F("\",\"H\":\"Camera address\",\"M\":\""), output); - BRIDGE::print((const char *)CONFIG::intTostr(MIN_DATA_LENGTH), output); - BRIDGE::print(F("\"}"), output); - } - - //end JSON - BRIDGE::println(F("\n]}"), output); - delay(0); - } - break; - - //Set EEPROM setting - //[ESP401]P= T= V= pwd= - case 401: { - //check validity of parameters - String spos = get_param(cmd_params,"P=", false); - String styp = get_param(cmd_params,"T=", false); - String sval = get_param(cmd_params,"V=", true); - sval.trim(); - int pos = spos.toInt(); - if ((pos == 0 && spos != "0") || (pos > LAST_EEPROM_ADDRESS || pos < 0)) { - response = false; - } - if (!(styp == "B" || styp == "S" || styp == "A" || styp == "I")) { - response = false; - } - if (sval.length() == 0) { - response = false; - } - - -#ifdef AUTHENTICATION_FEATURE - if (response) { - //check authentication - level_authenticate_type auth_need = LEVEL_ADMIN; - for (int i = 0; i < AUTH_ENTRY_NB; i++) { - if (Setting[i][0] == pos ) { - auth_need = (level_authenticate_type)(Setting[i][1]); - i = AUTH_ENTRY_NB; - } - } - if ((auth_need == LEVEL_ADMIN && auth_type == LEVEL_USER) || (auth_type == LEVEL_GUEST)) { - response = false; - } - } -#endif - if (response) { - if (styp == "B") { - byte bbuf = sval.toInt(); - if(!CONFIG::write_byte(pos,bbuf)) { - response = false; - } else { - //dynamique refresh is better than restart the board - if (pos == EP_TARGET_FW)CONFIG::InitFirmwareTarget(); - if (pos == EP_IS_DIRECT_SD){ - CONFIG::InitDirectSD(); - if (CONFIG::is_direct_sd) CONFIG::InitPins(); - } - } - } - if (styp == "I") { - int ibuf = sval.toInt(); - if(!CONFIG::write_buffer(pos,(const byte *)&ibuf,INTEGER_LENGTH)) { - response = false; - } - } - if (styp == "S") { - if(!CONFIG::write_string(pos,sval.c_str())) { - response = false; - } - } - if (styp == "A") { - byte ipbuf[4]; - if (CONFIG::split_ip(sval.c_str(),ipbuf) < 4) { - response = false; - } else if(!CONFIG::write_buffer(pos,ipbuf,IP_LENGTH)) { - response = false; - } - } - } - if(!response) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - } else { - BRIDGE::println(OK_CMD_MSG, output); - } - - } - break; - - //Get available AP list (limited to 30) - //output is JSON or plain text according parameter - //[ESP410] - case 410: { - parameter = get_param(cmd_params,"", true); - int n = WiFi.scanNetworks(); - bool plain = parameter == "plain"; - if (!plain)BRIDGE::print(F("{\"AP_LIST\":["), output); - for (int i = 0; i < n; ++i) { - if (i>0) { - if (!plain) BRIDGE::print(F(","), output); - else BRIDGE::print(F("\n"), output); - } - if (!plain)BRIDGE::print(F("{\"SSID\":\""), output); - BRIDGE::print(WiFi.SSID(i).c_str(), output); - if (!plain)BRIDGE::print(F("\",\"SIGNAL\":\""), output); - else BRIDGE::print(F("\t"), output); - BRIDGE::print(CONFIG::intTostr(wifi_config.getSignal(WiFi.RSSI(i))), output);; - //BRIDGE::print(F("%"), output); - if (!plain)BRIDGE::print(F("\",\"IS_PROTECTED\":\""), output); - if (WiFi.encryptionType(i) == ENC_TYPE_NONE) { - if (!plain)BRIDGE::print(F("0"), output); - else BRIDGE::print(F("\tOpen"), output); - } else { - if (!plain)BRIDGE::print(F("1"), output); - else BRIDGE::print(F("\tSecure"), output); - } - if (!plain)BRIDGE::print(F("\"}"), output); - } - if (!plain)BRIDGE::print(F("]}"), output); - else BRIDGE::print(F("\n"), output); - WiFi.scanDelete(); - } - break; - //Get ESP current status in plain or JSON - //[ESP420] - case 420: { - parameter = get_param(cmd_params,"", true); - CONFIG::print_config(output, (parameter == "plain")); - } - break; - //Set ESP mode - //cmd is RESET, SAFEMODE, RESTART - //[ESP444]pwd= - case 444: - parameter = get_param(cmd_params,"", true); -#ifdef AUTHENTICATION_FEATURE - if (auth_type != LEVEL_ADMIN) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else -#endif - { - if (parameter=="RESET") { - CONFIG::reset_config(); - BRIDGE::println(F("Reset done - restart needed"), output); - } else if (parameter=="SAFEMODE") { - wifi_config.Safe_Setup(); - BRIDGE::println(F("Set Safe Mode - restart needed"), output); - } else if (parameter=="RESTART") { - BRIDGE::println(F("Restart started"), output); - BRIDGE::flush( output); - CONFIG::esp_restart(); - } else { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } - } - break; -#ifdef AUTHENTICATION_FEATURE - //Change / Reset user password - //[ESP555]pwd= - case 555: { - if (auth_type == LEVEL_ADMIN) { - parameter = get_param(cmd_params,"", true); - if (parameter.length() == 0) { - if(CONFIG::write_string(EP_USER_PWD,FPSTR(DEFAULT_USER_PWD))) { - BRIDGE::println(OK_CMD_MSG, output); - } else { - BRIDGE::println(ERROR_CMD_MSG, output); - response = false; - } - } else { - if (CONFIG::isLocalPasswordValid(parameter.c_str())) { - if(CONFIG::write_string(EP_USER_PWD,parameter.c_str())) { - BRIDGE::println(OK_CMD_MSG, output); - } else { - BRIDGE::println(ERROR_CMD_MSG, output); - response = false; - } - } else { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } - } - } else { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } - break; - } -#endif - //[ESP700] - case 700: { //read local file - //be sure serial is locked - if ((web_interface->blockserial)) { - break; - } - cmd_params.trim() ; - if ((cmd_params.length() > 0) && (cmd_params[0] != '/')) { - cmd_params = "/" + cmd_params; - } - FS_FILE currentfile = SPIFFS.open(cmd_params, SPIFFS_FILE_READ); - if (currentfile) {//if file open success - //flush to be sure send buffer is empty - ESP_SERIAL_OUT.flush(); - //until no line in file - while (currentfile.available()) { - String currentline = currentfile.readStringUntil('\n'); - currentline.replace("\n",""); - currentline.replace("\r",""); - if (currentline.length() > 0) { - int ESPpos = currentline.indexOf("[ESP"); - if (ESPpos>-1) { - //is there the second part? - int ESPpos2 = currentline.indexOf("]",ESPpos); - if (ESPpos2>-1) { - //Split in command and parameters - String cmd_part1=currentline.substring(ESPpos+4,ESPpos2); - String cmd_part2=""; - //is there space for parameters? - if (ESPpos2 - case 710: - parameter = get_param(cmd_params,"", true); -#ifdef AUTHENTICATION_FEATURE - if (auth_type != LEVEL_ADMIN) { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } else -#endif - { - if (parameter=="FORMAT") { - BRIDGE::print(F("Formating"), output); - //SPIFFS.end(); - delay(0); - SPIFFS.format(); - //SPIFFS.begin(); - BRIDGE::println(F("...Done"), output); - } else { - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } - } - break; - //SPIFFS total size and used size - //[ESP720]
- case 720: - BRIDGE::print(cmd_params, output); -#ifdef ARDUINO_ARCH_ESP8266 - fs::FSInfo info; - SPIFFS.info(info); - BRIDGE::print("SPIFFS Total:", output); - BRIDGE::print(CONFIG::formatBytes(info.totalBytes).c_str(), output); - BRIDGE::print(" Used:", output); - BRIDGE::println(CONFIG::formatBytes(info.usedBytes).c_str(), output); -#else - BRIDGE::print("SPIFFS Total:", output); - BRIDGE::print(CONFIG::formatBytes(SPIFFS.totalBytes()).c_str(), output); - BRIDGE::print(" Used:", output); - BRIDGE::println(CONFIG::formatBytes(SPIFFS.usedBytes()).c_str(), output); -#endif - break; - //get fw version firmare target and fw version - //[ESP800]
- case 800: - { - byte sd_dir = 0; - BRIDGE::print(cmd_params, output); - BRIDGE::print(F("FW version:"), output); - BRIDGE::print(FW_VERSION, output); - BRIDGE::print(F(" # FW target:"), output); - BRIDGE::print(CONFIG::GetFirmwareTargetShortName(), output); - BRIDGE::print(F(" # FW HW:"), output); - if (CONFIG::is_direct_sd) BRIDGE::print(F("Direct SD"), output); - else BRIDGE::print(F("Serial SD"), output); - BRIDGE::print(F(" # primary sd:"), output); - if (!CONFIG::read_byte(EP_PRIMARY_SD, &sd_dir )) sd_dir = DEFAULT_PRIMARY_SD; - if (sd_dir == SD_DIRECTORY) BRIDGE::print(F("/sd/"), output); - else if (sd_dir == EXT_DIRECTORY) BRIDGE::print(F("/ext/"), output); - else BRIDGE::print(F("none"), output); - BRIDGE::print(F(" # secondary sd:"), output); - if (!CONFIG::read_byte(EP_SECONDARY_SD, &sd_dir )) sd_dir = DEFAULT_SECONDARY_SD; - if (sd_dir == SD_DIRECTORY) BRIDGE::print(F("/sd/"), output); - else if (sd_dir == EXT_DIRECTORY) BRIDGE::print(F("/ext/"), output); - else BRIDGE::print(F("none"), output); - BRIDGE::print(F(" # authentication:"), output); -#ifdef AUTHENTICATION_FEATURE - BRIDGE::print(F("yes"), output); -#else - BRIDGE::print(F("no"), output); -#endif - BRIDGE::println("", output); - } - break; - //get fw target - //[ESP801]
- case 801: - BRIDGE::print(cmd_params, output); - BRIDGE::println(CONFIG::GetFirmwareTargetShortName(), output); - break; - //clear status/error/info list - case 802: - if (CONFIG::check_update_presence( )) BRIDGE::println("yes", output); - else BRIDGE::println("no", output); - break; - //[ESP999] - case 999: - cmd_params.trim(); -#ifdef ERROR_MSG_FEATURE - if (cmd_params=="ERROR") { - web_interface->error_msg.clear(); - BRIDGE::println(OK_CMD_MSG, output); - break; - } -#endif -#ifdef INFO_MSG_FEATURE - if (cmd_params=="INFO") { - web_interface->info_msg.clear(); - BRIDGE::println(OK_CMD_MSG, output); - break; - } -#endif -#ifdef STATUS_MSG_FEATURE - if (cmd_params=="STATUS") { - web_interface->status_msg.clear(); - BRIDGE::println(OK_CMD_MSG, output); - break; - } -#endif - if (cmd_params=="ALL") { -#ifdef ERROR_MSG_FEATURE - web_interface->error_msg.clear(); -#endif -#ifdef STATUS_MSG_FEATURE - web_interface->status_msg.clear(); -#endif -#ifdef INFO_MSG_FEATURE - web_interface->info_msg.clear(); -#endif - BRIDGE::println(OK_CMD_MSG, output); - break; - } - default: - BRIDGE::println(INCORRECT_CMD_MSG, output); - response = false; - } - return response; -} - -bool COMMAND::check_command(String buffer, tpipe output, bool handlelockserial) -{ - String buffer2; - LOG("Check Command:") - LOG(buffer) - LOG("\r\n") - bool is_temp = false; - if ((buffer.indexOf("T:") > -1 ) || (buffer.indexOf("B:") > -1 )) is_temp = true; - //feed the WD for safety - delay(0); - if (( CONFIG::GetFirmwareTarget() == REPETIER4DV) || (CONFIG::GetFirmwareTarget() == REPETIER)) { - //save time no need to continue - if ((buffer.indexOf("busy:") > -1) || (buffer.startsWith("wait"))) { - return false; - } - if (buffer.startsWith("ok")) { - return false; - } - } -#ifdef ERROR_MSG_FEATURE - int Errorpos = -1; -#endif -#ifdef INFO_MSG_FEATURE - int Infopos = -1; -#endif -#ifdef STATUS_MSG_FEATURE - int Statuspos = -1; -#endif -if (CONFIG::GetFirmwareTarget() == SMOOTHIEWARE) { -#ifdef ERROR_MSG_FEATURE - Errorpos= buffer.indexOf("error:"); -#endif -#ifdef INFO_MSG_FEATURE - Infopos= buffer.indexOf("info:"); -#endif -#ifdef STATUS_MSG_FEATURE - Statuspos= buffer.indexOf("warning:"); -#endif -} else { -#ifdef ERROR_MSG_FEATURE - Errorpos= buffer.indexOf("Error:"); -#endif -#ifdef INFO_MSG_FEATURE - Infopos= buffer.indexOf("Info:"); -#endif -#ifdef STATUS_MSG_FEATURE - Statuspos= -1; - if (CONFIG::GetFirmwareTarget() == MARLIN){ - Statuspos= buffer.indexOf("echo:"); - } - else { - Statuspos= buffer.indexOf("Status:"); - } - -#endif -} - -#ifdef SERIAL_COMMAND_FEATURE - String ESP_Command; - int ESPpos = buffer.indexOf("[ESP"); - if (ESPpos>-1) { - //is there the second part? - int ESPpos2 = buffer.indexOf("]",ESPpos); - if (ESPpos2>-1) { - //Split in command and parameters - String cmd_part1=buffer.substring(ESPpos+4,ESPpos2); - String cmd_part2=""; - //is there space for parameters? - if (ESPpos2-1 && !(buffer.indexOf("Format error")!=-1 || buffer.indexOf("wait")==Errorpos+6) ) { - String ss = buffer.substring(Errorpos+6); - ss.replace("\"",""); - ss.replace("'",""); - (web_interface->error_msg).add(ss.c_str()); - } -#endif -#ifdef INFO_MSG_FEATURE - //Info - if (Infopos>-1) { - String ss = buffer.substring(Errorpos+5); - ss.replace("\"",""); - ss.replace("'",""); - (web_interface->info_msg).add(ss.c_str()); - } -#endif -#ifdef STATUS_MSG_FEATURE - //Status - if (Statuspos>-1) { - String ss ; - if (CONFIG::GetFirmwareTarget() == SMOOTHIEWARE)ss = buffer.substring(Errorpos+8); - else if (CONFIG::GetFirmwareTarget() == MARLIN) ss = buffer.substring(Errorpos+5); - else ss = buffer.substring(Errorpos+7); - ss.replace("\"",""); - ss.replace("'",""); - (web_interface->info_msg).add(ss.c_str()); - } -#endif - - return is_temp; -} - -//read a buffer in an array -void COMMAND::read_buffer_serial(uint8_t *b, size_t len) -{ - for (long i = 0; i< len; i++) { - read_buffer_serial(b[i]); - //*b++; - } -} - -#ifdef TCP_IP_DATA_FEATURE -//read buffer as char -void COMMAND::read_buffer_tcp(uint8_t b) -{ - static bool previous_was_char=false; - static bool iscomment=false; -//to ensure it is continuous string, no char separated by binaries - if (!previous_was_char) { - buffer_tcp=""; - iscomment = false; - } -//is comment ? - if (char(b) == ';') { - iscomment = true; - } -//it is a char so add it to buffer - if (isPrintable(b)) { - previous_was_char=true; - //add char if not a comment - if (!iscomment) { - buffer_tcp+=char(b); - } - } else { - previous_was_char=false; //next call will reset the buffer - } -//this is not printable but end of command check if need to handle it - if (b==13 || b==10) { - //reset comment flag - iscomment = false; - //Minimum is something like M10 so 3 char - if (buffer_tcp.length()>3) { - check_command(buffer_tcp, TCP_PIPE); - } - } -} -#endif -//read buffer as char -void COMMAND::read_buffer_serial(uint8_t b) -{ - static bool previous_was_char=false; - static bool iscomment=false; -//to ensure it is continuous string, no char separated by binaries - if (!previous_was_char) { - buffer_serial=""; - iscomment = false; - } -//is comment ? - if (char(b) == ';') { - iscomment = true; - } -//it is a char so add it to buffer - if (isPrintable(b)) { - previous_was_char=true; - if (!iscomment) { - buffer_serial+=char(b); - } - } else { - previous_was_char=false; //next call will reset the buffer - } -//this is not printable but end of command check if need to handle it - if (b==13 || b==10) { - //reset comment flag - iscomment = false; - //Minimum is something like M10 so 3 char - if (buffer_serial.length()>3) { - check_command(buffer_serial, SERIAL_PIPE); - } - } -} diff --git a/esp3d/command.h b/esp3d/command.h deleted file mode 100644 index 2c055648..00000000 --- a/esp3d/command.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - command.h - ESP3D configuration class - - Copyright (c) 2014 Luc Lebosse. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef COMMAND_h -#define COMMAND_h -#include -#include "bridge.h" - -class COMMAND -{ -public: - static String buffer_serial; - static String buffer_tcp; - static void read_buffer_serial(uint8_t *b, size_t len); - static void read_buffer_serial(uint8_t b); -#ifdef TCP_IP_DATA_FEATURE - static void read_buffer_tcp(uint8_t b); -#endif - static bool check_command(String buffer, tpipe output, bool handlelockserial = true); - static bool execute_command(int cmd,String cmd_params, tpipe output, level_authenticate_type auth_level = LEVEL_GUEST); - static String get_param(String & cmd_params, const char * id, bool withspace = false); - static bool isadmin(String & cmd_params); - static bool isuser(String & cmd_params); -}; - -#endif diff --git a/esp3d/config.cpp b/esp3d/config.cpp deleted file mode 100644 index 9b55b265..00000000 --- a/esp3d/config.cpp +++ /dev/null @@ -1,1865 +0,0 @@ -/* - config.cpp- ESP3D configuration class - - Copyright (c) 2014 Luc Lebosse. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ -#include "config.h" -#include -#ifndef FS_NO_GLOBALS -#define FS_NO_GLOBALS -#endif -#include -#include -#include "wificonf.h" -#ifdef ARDUINO_ARCH_ESP8266 -extern "C" { -#include "user_interface.h" -} -#else -#include "Update.h" -#include "esp_wifi.h" -#endif -#include "bridge.h" - - -uint8_t CONFIG::FirmwareTarget = UNKNOWN_FW; - -bool CONFIG::SetFirmwareTarget(uint8_t fw){ - if ( fw <= MAX_FW_ID) { - FirmwareTarget = fw; - return true; - } else return false; -} -uint8_t CONFIG::GetFirmwareTarget() { - return FirmwareTarget; -} -const char* CONFIG::GetFirmwareTargetName() { - static String response; - if ( CONFIG::FirmwareTarget == REPETIER4DV)response = F("Repetier for Davinci"); - else if ( CONFIG::FirmwareTarget == REPETIER)response = F("Repetier"); - else if ( CONFIG::FirmwareTarget == MARLIN) response = F("Marlin"); - else if ( CONFIG::FirmwareTarget == MARLINKIMBRA) response = F("MarlinKimbra"); - else if ( CONFIG::FirmwareTarget == SMOOTHIEWARE) response = F("Smoothieware"); - else response = F("???"); - return response.c_str(); -} - -const char* CONFIG::GetFirmwareTargetShortName() { - static String response; - if ( CONFIG::FirmwareTarget == REPETIER4DV)response = F("repetier4davinci"); - else if ( CONFIG::FirmwareTarget == REPETIER)response = F("repetier"); - else if ( CONFIG::FirmwareTarget == MARLIN) response = F("marlin"); - else if ( CONFIG::FirmwareTarget == MARLINKIMBRA) response = F("marlinkimbra"); - else if ( CONFIG::FirmwareTarget == SMOOTHIEWARE) response = F("smoothieware"); - else response = F("???"); - return response.c_str(); -} - -void CONFIG::InitFirmwareTarget(){ - uint8_t b = UNKNOWN_FW; - if (!CONFIG::read_byte(EP_TARGET_FW, &b )) { - b = UNKNOWN_FW; - } - if (!SetFirmwareTarget(b))SetFirmwareTarget(UNKNOWN_FW) ; -} - -void CONFIG::InitDirectSD(){ - CONFIG::is_direct_sd = false; - -} - -bool CONFIG::InitBaudrate(){ - long baud_rate=0; - if ( !CONFIG::read_buffer(EP_BAUD_RATE, (byte *)&baud_rate, INTEGER_LENGTH)) return false; - if ( ! (baud_rate==9600 || baud_rate==19200 ||baud_rate==38400 ||baud_rate==57600 ||baud_rate==115200 ||baud_rate==230400 ||baud_rate==250000) ) return false; - //setup serial - if (ESP_SERIAL_OUT.baudRate() != baud_rate)ESP_SERIAL_OUT.begin(baud_rate); -#ifdef ARDUINO_ARCH_ESP8266 - ESP_SERIAL_OUT.setRxBufferSize(SERIAL_RX_BUFFER_SIZE); -#endif - wifi_config.baud_rate=baud_rate; - delay(1000); - return true; -} - -bool CONFIG::InitExternalPorts(){ - if (!CONFIG::read_buffer(EP_WEB_PORT, (byte *)&(wifi_config.iweb_port), INTEGER_LENGTH) || !CONFIG::read_buffer(EP_DATA_PORT, (byte *)&(wifi_config.idata_port), INTEGER_LENGTH)) return false; - if (wifi_config.iweb_port < DEFAULT_MIN_WEB_PORT ||wifi_config.iweb_port > DEFAULT_MAX_WEB_PORT || wifi_config.idata_port < DEFAULT_MIN_DATA_PORT || wifi_config.idata_port > DEFAULT_MAX_DATA_PORT) return false; - return true; -} - -#ifdef SDCARD_CONFIG_FEATURE -bool CONFIG::update_settings(){ - String filename = SDCARD_CONFIG_FILENAME; - filename.toLowerCase(); - //there is a config file - LOG("Check ") - LOG(filename) - LOG("\r\n") - bool answer = true; - if(SD.exists((const char *)filename.c_str())) { - bool success = true; - bool localerror = false; - const size_t bufferLen = 250; - char buffer[bufferLen]; - byte ip_sav[4]; - String stmp; - int itmp; - long baud_rate=0; - byte bflag; - LOG("Found config file\r\n") - String newfilename = filename; - IniFile espconfig((char *)filename.c_str()); - //validate file is correct - if (espconfig.open()) { - if (!espconfig.validate(buffer, bufferLen)) { - success = false; - LOG("Invalid config file\r\n") - } else { //file format is correct - let parse the settings - //Section [wifi] - //Hostname - //hostname = myesp - if (espconfig.getValue("network", "hostname", buffer, bufferLen)) { - if (!CONFIG::isHostnameValid(buffer)) { - success = false; - } else if(!CONFIG::write_string(EP_HOSTNAME,buffer)) { - success = false; - } - } - //baudrate = 115200 - if (espconfig.getValue("network", "baudrate", buffer, bufferLen, baud_rate)) { - if(!CONFIG::write_buffer(EP_BAUD_RATE,(const byte *)&baud_rate,INTEGER_LENGTH)) { - success = false; - } - } - //webport = 80 - if (espconfig.getValue("network", "webport", buffer, bufferLen, itmp)) { - if(!CONFIG::write_buffer(EP_WEB_PORT,(const byte *)&itmp,INTEGER_LENGTH)) { - success = false; - } - } - //dataport = 8888 - if (espconfig.getValue("network", "dataport", buffer, bufferLen, itmp)) { - if(!CONFIG::write_buffer(EP_DATA_PORT,(const byte *)&itmp,INTEGER_LENGTH)) { - success = false; - } - } - //adminpwd = admin - if (espconfig.getValue("network", "adminpwd", buffer, bufferLen)) { - if (!CONFIG::isLocalPasswordValid(buffer)) { - success = false; - } else if(!CONFIG::write_string(EP_ADMIN_PWD,buffer)) { - success = false; - } - } - //userpwd = user - if (espconfig.getValue("network", "userpwd", buffer, bufferLen)) { - if (!CONFIG::isLocalPasswordValid(buffer)) { - success = false; - } else if(!CONFIG::write_string(EP_USER_PWD,buffer)) { - success = false; - } - } - //sleep = none - if (espconfig.getValue("network", "sleep", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="none") { - bflag = WIFI_NONE_SLEEP; -#ifdef ARDUINO_ARCH_ESP8266 - } else if (stmp =="light") { - bflag = WIFI_LIGHT_SLEEP; -#endif - } else if (stmp =="modem") { - bflag = WIFI_MODEM_SLEEP; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_SLEEP_MODE,bflag)) { - success = false; - } - } - } - //wifimode = STA - if (espconfig.getValue("network", "wifimode", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="sta") { - bflag = CLIENT_MODE; - } else if (stmp =="ap") { - bflag = AP_MODE; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_WIFI_MODE,bflag)) { - success = false; - } - } - } - //STAssid = NETGEAR_2GEXT_OFFICE2 - if (espconfig.getValue("network", "STAssid", buffer, bufferLen)) { - if (!CONFIG::isSSIDValid(buffer)) { - success = false; - } else if(!CONFIG::write_string(EP_STA_SSID,buffer)) { - success = false; - } - } - //STApassword = mypassword - if (espconfig.getValue("network", "STApassword", buffer, bufferLen)) { - if (!CONFIG::isPasswordValid(buffer)) { - success = false; - } else if(!CONFIG::write_string(EP_STA_PASSWORD,buffer)) { - success = false; - } - } - //STAipmode = DHCP - if (espconfig.getValue("network", "STAipmode", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="dhcp") { - bflag = DHCP_MODE; - } else if (stmp =="static") { - bflag = STATIC_IP_MODE; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_STA_IP_MODE,bflag)) { - success = false; - } - } - } - //STAstatic_ip = 192.168.0.1 - if (espconfig.getValue("network", "STAstatic_ip", buffer, bufferLen)) { - if (!CONFIG::isIPValid(buffer)) { - success = false; - } else { - CONFIG::split_ip(buffer,ip_sav); - if(!CONFIG::write_buffer(EP_STA_IP_VALUE,ip_sav,IP_LENGTH)) { - success = false; - } - } - } - //STAstatic_mask = 255.255.255.0 - if (espconfig.getValue("network", "STAstatic_mask", buffer, bufferLen)) { - if (!CONFIG::isIPValid(buffer)) { - success = false; - } else { - CONFIG::split_ip(buffer,ip_sav); - if(!CONFIG::write_buffer(EP_STA_MASK_VALUE,ip_sav,IP_LENGTH)) { - success = false; - } - } - } - //STAstatic_gateway = 192.168.0.1 - if (espconfig.getValue("network", "STAstatic_gateway", buffer, bufferLen)) { - if (!CONFIG::isIPValid(buffer)) { - success = false; - } else { - CONFIG::split_ip(buffer,ip_sav); - if(!CONFIG::write_buffer(EP_STA_GATEWAY_VALUE,ip_sav,IP_LENGTH)) { - success = false; - } - } - } - //STANetwork_mode = 11g - if (espconfig.getValue("network", "STANetwork_mode", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="11b") { - bflag = WIFI_PHY_MODE_11B; - } else if (stmp =="11g") { - bflag = WIFI_PHY_MODE_11G; - } else if (stmp =="11n") { - bflag = WIFI_PHY_MODE_11N; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_STA_PHY_MODE,bflag)) { - success = false; - } - } - } - //APssid = NETGEAR_2GEXT_OFFICE2 - if (espconfig.getValue("network", "APssid", buffer, bufferLen)) { - if (!CONFIG::isSSIDValid(buffer)) { - success = false; - } else if(!CONFIG::write_string(EP_AP_SSID,buffer)) { - success = false; - } - } - //APpassword = 12345678 - if (espconfig.getValue("network", "APpassword", buffer, bufferLen)) { - if (!CONFIG::isPasswordValid(buffer)) { - success = false; - } else if(!CONFIG::write_string(EP_AP_PASSWORD,buffer)) { - success = false; - } - } - //APipmode = STATIC - if (espconfig.getValue("network", "APipmode", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="dhcp") { - bflag = DHCP_MODE; - } else if (stmp =="static") { - bflag = STATIC_IP_MODE; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_AP_IP_MODE,bflag)) { - success = false; - } - } - } - //APstatic_ip = 192.168.0.1 - if (espconfig.getValue("network", "APstatic_ip", buffer, bufferLen)) { - if (!CONFIG::isIPValid(buffer)) { - success = false; - } else { - CONFIG::split_ip(buffer,ip_sav); - if(!CONFIG::write_buffer(EP_AP_IP_VALUE,ip_sav,IP_LENGTH)) { - success = false; - } - } - } - //APstatic_mask = 255.255.255.0 - if (espconfig.getValue("network", "APstatic_mask", buffer, bufferLen)) { - if (!CONFIG::isIPValid(buffer)) { - success = false; - } else { - CONFIG::split_ip(buffer,ip_sav); - if(!CONFIG::write_buffer(EP_AP_MASK_VALUE,ip_sav,IP_LENGTH)) { - success = false; - } - } - } - //APstatic_gateway = 192.168.0.1 - if (espconfig.getValue("network", "APstatic_gateway", buffer, bufferLen)) { - if (!CONFIG::isIPValid(buffer)) { - success = false; - } else { - CONFIG::split_ip(buffer,ip_sav); - if(!CONFIG::write_buffer(EP_AP_GATEWAY_VALUE,ip_sav,IP_LENGTH)) { - success = false; - } - } - } - //AP_channel = 1 - if (espconfig.getValue("network", "AP_channel", buffer, bufferLen, itmp)) { - bflag = itmp; - if(!CONFIG::write_byte(EP_CHANNEL,bflag)) { - success = false; - } - } - //AP_visible = yes - if (espconfig.getValue("network", "AP_visible", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="yes") { - bflag = 1; - } else if (stmp =="no") { - bflag = 0; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_SSID_VISIBLE,bflag)) { - success = false; - } - } - } - //AP_auth = WPA - if (espconfig.getValue("network", "AP_auth", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="open") { - bflag = AUTH_OPEN; - } else if (stmp =="wpa") { - bflag = AUTH_WPA_PSK; - } else if (stmp =="wpa2") { - bflag = AUTH_WPA2_PSK; - } else if (stmp =="wpa_wpa2") { - bflag = AUTH_WPA_WPA2_PSK; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_AUTH_TYPE,bflag)) { - success = false; - } - } - } - //APNetwork_mode = 11g - if (espconfig.getValue("network", "APNetwork_mode", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="11b") { - bflag = WIFI_PHY_MODE_11B; - } else if (stmp =="11g") { - bflag = WIFI_PHY_MODE_11G; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_AP_PHY_MODE,bflag)) { - success = false; - } - } - } - - //Timezone - if (espconfig.getValue("network", "time_zone", buffer, bufferLen, itmp)) { - bflag = itmp; - if(!CONFIG::write_byte(EP_TIMEZONE,bflag)) { - success = false; - } - } - - //day saving time - if (espconfig.getValue("network", "day_st", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="yes") { - bflag = 1; - } else if (stmp =="no") { - bflag = 0; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_TIME_ISDST,bflag)) { - success = false; - } - } - } - //time server 1 - if (espconfig.getValue("network", "time_server_1", buffer, bufferLen)) { - if (strlen(buffer) > 128) { - success = false; - } else if(!CONFIG::write_string(EP_TIME_SERVER1,buffer)) { - success = false; - } - } - - //time server 2 - if (espconfig.getValue("network", "time_server_2", buffer, bufferLen)) { - if (strlen(buffer) > 128) { - success = false; - } else if(!CONFIG::write_string(EP_TIME_SERVER2,buffer)) { - success = false; - } - } - - //time server 3 - if (espconfig.getValue("network", "time_server_3", buffer, bufferLen)) { - if (strlen(buffer) > 128) { - success = false; - } else if(!CONFIG::write_string(EP_TIME_SERVER3,buffer)) { - success = false; - } - } - - //Section [printer] - //data = 192.168.1.1/video.cgi?user=luc&pwd=mypassword - if (espconfig.getValue("printer", "data", buffer, bufferLen)) { - if (strlen(buffer) > 128) { - success = false; - } else if(!CONFIG::write_string(EP_DATA_STRING,buffer)) { - success = false; - } - } - //refreshrate = 3 - if (espconfig.getValue("printer", "refreshrate", buffer, bufferLen, itmp)) { - bflag = itmp; - if(!CONFIG::write_byte(EP_REFRESH_PAGE_TIME,bflag)) { - success = false; - } - } - //refreshrate2 = 3 - if (espconfig.getValue("printer", "refreshrate2", buffer, bufferLen, itmp)) { - bflag = itmp; - if(!CONFIG::write_byte(EP_REFRESH_PAGE_TIME2,bflag)) { - success = false; - } - } - //XY_feedrate = 1000 - if (espconfig.getValue("printer", "XY_feedrate", buffer, bufferLen, itmp)) { - if(!CONFIG::write_buffer(EP_XY_FEEDRATE,(const byte *)&itmp,INTEGER_LENGTH)) { - success = false; - } - } - //Z_feedrate = 100 - if (espconfig.getValue("printer", "Z_feedrate", buffer, bufferLen, itmp)) { - if(!CONFIG::write_buffer(EP_Z_FEEDRATE,(const byte *)&itmp,INTEGER_LENGTH)) { - success = false; - } - } - //E_feedrate = 400 - if (espconfig.getValue("printer", "E_feedrate", buffer, bufferLen, itmp)) { - if(!CONFIG::write_buffer(EP_E_FEEDRATE,(const byte *)&itmp,INTEGER_LENGTH)) { - success = false; - } - } - - //target_printer= smoothieware - if (espconfig.getValue("printer", "target_printer", buffer, bufferLen)) { - stmp = buffer; - bflag = UNKNOWN_FW; - if ( stmp.equalsIgnoreCase(String(F("repetier"))))bflag = REPETIER; - else if ( stmp.equalsIgnoreCase(String(F("repetier4davinci"))))bflag = REPETIER4DV; - else if ( stmp.equalsIgnoreCase(String(F("marlin"))))bflag = MARLIN; - else if ( stmp.equalsIgnoreCase(String(F("marlinkimbra"))))bflag = MARLINKIMBRA; - else if ( stmp.equalsIgnoreCase(String(F("smoothieware"))))bflag = SMOOTHIEWARE; - else success = false; - if(!(success && CONFIG::write_byte(EP_TARGET_FW,bflag))) { - success = false; - } - } - - //direct sd connection - if (espconfig.getValue("printer", "direct_sd", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="yes") { - bflag = 1; - } else if (stmp =="no") { - bflag = 0; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_IS_DIRECT_SD,bflag)) { - success = false; - } - } - } - //sd check update at boot - if (espconfig.getValue("printer", "sd_check_update", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="yes") { - bflag = 1; - } else if (stmp =="no") { - bflag = 0; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_SD_CHECK_UPDATE_AT_BOOT,bflag)) { - success = false; - } - } - } - //direct sd boot check - if (espconfig.getValue("printer", "direct_sd_boot_check", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="yes") { - bflag = 1; - } else if (stmp =="no") { - bflag = 0; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_DIRECT_SD_CHECK,bflag)) { - success = false; - } - } - } - - //primary sd directory - if (espconfig.getValue("printer", "primary_sd ", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="none") { - bflag = 0; - } else if (stmp =="sd") { - bflag = 1; - } else if (stmp =="ext") { - bflag = 2; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_PRIMARY_SD,bflag)) { - success = false; - } - } - } - - //secondary sd directory - if (espconfig.getValue("printer", "secondary_sd ", buffer, bufferLen)) { - stmp = buffer; - localerror = false; - stmp.toLowerCase(); - bflag = 0; - if (stmp =="none") { - bflag = 0; - } else if (stmp =="sd") { - bflag = 1; - } else if (stmp =="ext") { - bflag = 2; - } else { - localerror = true; - success = false; - } - if (!localerror) { - if(!CONFIG::write_byte(EP_SECONDARY_SD,bflag)) { - success = false; - } - } - } - - } - espconfig.close(); - if(success) { - newfilename.replace(String(".txt"), String(".ok")); - } else { - newfilename.replace(String(".txt"), String(".bad")); - answer = false; - } - //rename if name is already used - if (!CONFIG::renameFile (newfilename)) { - LOG("Failed to rename previous file\r\n") - } - if (SD.rename((const char *)filename.c_str(),(const char *)newfilename.c_str())) { - LOG("File renamed, restarted file\r\n") - } else { - return false; - LOG("Failed to rename file\r\n") - } - } else { - return false; - LOG("Failed to open config file\r\n") - } - } else { - return false; - LOG("No config file\r\n") - } - return answer; -} -#endif -void CONFIG::esp_restart() -{ - LOG("Restarting\r\n") - ESP_SERIAL_OUT.flush(); - delay(500); -#ifdef ARDUINO_ARCH_ESP8266 - ESP_SERIAL_OUT.swap(); -#endif - delay(100); - ESP.restart(); - while (1) { - delay(1); - }; -} - -void CONFIG::InitPins(){ -#ifdef RECOVERY_FEATURE - pinMode(RESET_CONFIG_PIN, INPUT); -#endif -} - -bool CONFIG::is_direct_sd = false; - -bool CONFIG::isHostnameValid(const char * hostname) -{ - //limited size - char c; - if (strlen(hostname)>MAX_HOSTNAME_LENGTH || strlen(hostname) < MIN_HOSTNAME_LENGTH) { - return false; - } - //only letter and digit - for (int i=0; i < strlen(hostname); i++) { - c = hostname[i]; - if (!(isdigit(c) || isalpha(c) || c=='_')) { - return false; - } - if (c==' ') { - return false; - } - } - return true; -} - -bool CONFIG::isSSIDValid(const char * ssid) -{ - //limited size - //char c; - if (strlen(ssid)>MAX_SSID_LENGTH || strlen(ssid)MAX_PASSWORD_LENGTH) { - return false; - } - #if MIN_PASSWORD_LENGTH > 0 - if (strlen(password)MAX_LOCAL_PASSWORD_LENGTH)|| (strlen(password)15 || strlen(IP)==0) { - return false; - } - //cannot start with . - if (IP[0]=='.') { - return false; - } - //only letter and digit - for (int i=0; i < strlen(IP); i++) { - c = IP[i]; - if (isdigit(c)) { - //only 3 digit at once - internalcount++; - previouswasdot=false; - if (internalcount>3) { - return false; - } - } else if(c=='.') { - //cannot have 2 dots side by side - if (previouswasdot) { - return false; - } - previouswasdot=true; - internalcount=0; - dotcount++; - }//if not a dot neither a digit it is wrong - else { - return false; - } - } - //if not 3 dots then it is wrong - if (dotcount!=3) { - return false; - } - //cannot have the last dot as last char - if (IP[strlen(IP)-1]=='.') { - return false; - } - return true; -} - -char * CONFIG::intTostr(int value) -{ - static char result [12]; - sprintf(result,"%d",value); - return result; -} - -String CONFIG::formatBytes(uint32_t bytes) -{ - if (bytes < 1024) { - return String(bytes)+" B"; - } else if(bytes < (1024 * 1024)) { - return String(bytes/1024.0)+" KB"; - } else if(bytes < (1024 * 1024 * 1024)) { - return String(bytes/1024.0/1024.0)+" MB"; - } else { - return String(bytes/1024.0/1024.0/1024.0)+" GB"; - } -} - -//helper to convert string to IP -//do not use IPAddress.fromString() because lack of check point and error result -//return number of parts -byte CONFIG::split_ip (const char * ptr,byte * part) -{ - if (strlen(ptr)>15 || strlen(ptr)< 7) { - part[0]=0; - part[1]=0; - part[2]=0; - part[3]=0; - return 0; - } - - char pstart [16]; - char * ptr2; - strcpy(pstart,ptr); - ptr2 = pstart; - byte i = strlen(pstart); - byte pos = 0; - for (byte j=0; jsprintf(macstr,"%02X:%02X:%02X:%02X:%02X:%02X",mac[0],mac[1],mac[2],mac[3],mac[4],mac[5])) { - strcpy (macstr, "00:00:00:00:00:00"); - } - return macstr; -} - - -//read a string -//a string is multibyte + \0, this is won't work if 1 char is multibyte like chinese char -bool CONFIG::read_string(int pos, char byte_buffer[], int size_max) -{ - //check if parameters are acceptable - if (size_max==0 || pos+size_max+1 > EEPROM_SIZE || byte_buffer== NULL) { - LOG("Error read string\r\n") - return false; - } - EEPROM.begin(EEPROM_SIZE); - byte b = 13; // non zero for the while loop below - int i=0; - - //read until max size is reached or \0 is found - while (i < size_max && b != 0) { - b = EEPROM.read(pos+i); - byte_buffer[i]=b; - i++; - } - - // Be sure there is a 0 at the end. - if (b!=0) { - byte_buffer[i-1]=0x00; - } - EEPROM.end(); - - return true; -} - -bool CONFIG::read_string(int pos, String & sbuffer, int size_max) -{ - //check if parameters are acceptable - if (size_max==0 || pos+size_max+1 > EEPROM_SIZE ) { - LOG("Error read string\r\n") - return false; - } - byte b = 13; // non zero for the while loop below - int i=0; - sbuffer=""; - - EEPROM.begin(EEPROM_SIZE); - //read until max size is reached or \0 is found - while (i < size_max && b != 0) { - b = EEPROM.read(pos+i); - if (b!=0) { - sbuffer+=char(b); - } - i++; - } - EEPROM.end(); - - return true; -} - -//read a buffer of size_buffer -bool CONFIG::read_buffer(int pos, byte byte_buffer[], int size_buffer) -{ - //check if parameters are acceptable - if (size_buffer==0 || pos+size_buffer > EEPROM_SIZE || byte_buffer== NULL) { - LOG("Error read buffer\r\n") - return false; - } - int i=0; - EEPROM.begin(EEPROM_SIZE); - //read until max size is reached - while (i EEPROM_SIZE) { - LOG("Error read byte\r\n") - return false; - } - EEPROM.begin(EEPROM_SIZE); - value[0] = EEPROM.read(pos); - EEPROM.end(); - return true; -} - -bool CONFIG::write_string(int pos, const __FlashStringHelper *str) -{ - String stmp = str; - return write_string(pos,stmp.c_str()); -} - -bool CONFIG::check_update_presence( ){ - bool result = false; - if (CONFIG::is_direct_sd) { - long baud_rate=0; - if (!CONFIG::read_buffer(EP_BAUD_RATE, (byte *)&baud_rate, INTEGER_LENGTH)) return false; - if (ESP_SERIAL_OUT.baudRate() != baud_rate)ESP_SERIAL_OUT.begin(baud_rate); - CONFIG::InitFirmwareTarget(); - delay(500); - String cmd = "M20"; - //By default M20 should be applied - //if (CONFIG::FirmwareTarget == UNKNOWN_FW) return false; - if (CONFIG::FirmwareTarget == SMOOTHIEWARE) { - byte sd_dir = 0; - if (!CONFIG::read_byte(EP_PRIMARY_SD, &sd_dir )) sd_dir = DEFAULT_PRIMARY_SD; - if (sd_dir == SD_DIRECTORY) cmd = "ls /sd"; - else if (sd_dir == EXT_DIRECTORY) cmd = "ls /ext"; - else return false; - } - String tmp; - int count ; - //send command to serial as no need to transfer ESP command - //to avoid any pollution if Uploading file to SDCard - //block every query - //empty the serial buffer and incoming data - if(ESP_SERIAL_OUT.available()) { - BRIDGE::processFromSerial2TCP(); - delay(1); - } - //Send command - ESP_SERIAL_OUT.println(cmd); - count = 0; - String current_buffer; - String current_line; - //int pos; - int temp_counter = 0; - - //pickup the list - while (count < MAX_TRY) { - //give some time between each buffer - if (ESP_SERIAL_OUT.available()) { - count = 0; - size_t len = ESP_SERIAL_OUT.available(); - uint8_t sbuf[len+1]; - //read buffer - ESP_SERIAL_OUT.readBytes(sbuf, len); - //change buffer as string - sbuf[len]='\0'; - //add buffer to current one if any - current_buffer += (char * ) sbuf; - while (current_buffer.indexOf("\n") !=-1) { - //remove the possible "\r" - current_buffer.replace("\r",""); - //pos = current_buffer.indexOf("\n"); - //get line - current_line = current_buffer.substring(0,current_buffer.indexOf("\n")); - //if line is command ack - just exit so save the time out period - if ((current_line == "ok") || (current_line == "wait")) { - count = MAX_TRY; - break; - } - //check line - //save time no need to continue - if (current_line.indexOf("busy:") > -1 || current_line.indexOf("T:") > -1 || current_line.indexOf("B:") > -1) { - temp_counter++; - } else { - } - if (temp_counter > 5) { - break; - } - //current remove line from buffer - tmp = current_buffer.substring(current_buffer.indexOf("\n")+1,current_buffer.length()); - current_buffer = tmp; - delay(0); - } - delay (0); - } else { - delay(1); - } - //it is sending too many temp status should be heating so let's exit the loop - if (temp_counter > 5) { - count = MAX_TRY; - } - count++; - } - if(ESP_SERIAL_OUT.available()) { - BRIDGE::processFromSerial2TCP(); - delay(1); - } - } - return result; -} - - -//write a string (array of byte with a 0x00 at the end) -bool CONFIG::write_string(int pos, const char * byte_buffer) -{ - int size_buffer; - int maxsize = EEPROM_SIZE; - size_buffer= strlen(byte_buffer); - //check if parameters are acceptable - switch (pos) { - case EP_ADMIN_PWD: - case EP_USER_PWD: - maxsize = MAX_LOCAL_PASSWORD_LENGTH; - break; - case EP_AP_SSID: - case EP_STA_SSID: - maxsize = MAX_SSID_LENGTH; - break; - case EP_AP_PASSWORD: - case EP_STA_PASSWORD: - maxsize = MAX_PASSWORD_LENGTH; - break; - case EP_HOSTNAME: - maxsize = MAX_HOSTNAME_LENGTH; - break; - case EP_TIME_SERVER1: - case EP_TIME_SERVER2: - case EP_TIME_SERVER3: - case EP_DATA_STRING: - maxsize = MAX_DATA_LENGTH; - break; - default: - maxsize = EEPROM_SIZE; - break; - } - if ((size_buffer==0 && !(pos == EP_DATA_STRING)) || pos+size_buffer+1 > EEPROM_SIZE || size_buffer > maxsize || byte_buffer== NULL) { - LOG("Error write string\r\n") - return false; - } - //copy the value(s) - EEPROM.begin(EEPROM_SIZE); - for (int i = 0; i < size_buffer; i++) { - EEPROM.write(pos + i, byte_buffer[i]); - } - - //0 terminal - EEPROM.write(pos + size_buffer, 0x00); - EEPROM.commit(); - EEPROM.end(); - return true; -} - -//write a buffer -bool CONFIG::write_buffer(int pos, const byte * byte_buffer, int size_buffer) -{ - //check if parameters are acceptable - if (size_buffer==0 || pos+size_buffer > EEPROM_SIZE || byte_buffer== NULL) { - LOG("Error write buffer\r\n") - return false; - } - EEPROM.begin(EEPROM_SIZE); - //copy the value(s) - for (int i = 0; i < size_buffer; i++) { - EEPROM.write(pos + i, byte_buffer[i]); - } - EEPROM.commit(); - EEPROM.end(); - return true; -} - -//read a flag / byte -bool CONFIG::write_byte(int pos, const byte value) -{ - //check if parameters are acceptable - if (pos+1 > EEPROM_SIZE) { - LOG("Error write byte\r\n") - return false; - } - EEPROM.begin(EEPROM_SIZE); - EEPROM.write(pos, value); - EEPROM.commit(); - EEPROM.end(); - return true; -} - -bool CONFIG::reset_config() -{ - if(!CONFIG::write_string(EP_DATA_STRING,"")) { - return false; - } - if(!CONFIG::write_byte(EP_WIFI_MODE,DEFAULT_WIFI_MODE)) { - return false; - } - if(!CONFIG::write_buffer(EP_BAUD_RATE,(const byte *)&DEFAULT_BAUD_RATE,INTEGER_LENGTH)) { - return false; - } - if(!CONFIG::write_string(EP_AP_SSID,FPSTR(DEFAULT_AP_SSID))) { - return false; - } - if(!CONFIG::write_string(EP_AP_PASSWORD,FPSTR(DEFAULT_AP_PASSWORD))) { - return false; - } - if(!CONFIG::write_string(EP_STA_SSID,FPSTR(DEFAULT_STA_SSID))) { - return false; - } - if(!CONFIG::write_string(EP_STA_PASSWORD,FPSTR(DEFAULT_STA_PASSWORD))) { - return false; - } - if(!CONFIG::write_byte(EP_AP_IP_MODE,DEFAULT_AP_IP_MODE)) { - return false; - } - if(!CONFIG::write_byte(EP_STA_IP_MODE,DEFAULT_STA_IP_MODE)) { - return false; - } - if(!CONFIG::write_buffer(EP_STA_IP_VALUE,DEFAULT_IP_VALUE,IP_LENGTH)) { - return false; - } - if(!CONFIG::write_buffer(EP_STA_MASK_VALUE,DEFAULT_MASK_VALUE,IP_LENGTH)) { - return false; - } - if(!CONFIG::write_buffer(EP_STA_GATEWAY_VALUE,DEFAULT_GATEWAY_VALUE,IP_LENGTH)) { - return false; - } - if(!CONFIG::write_byte(EP_STA_PHY_MODE,DEFAULT_PHY_MODE)) { - return false; - } - if(!CONFIG::write_buffer(EP_AP_IP_VALUE,DEFAULT_IP_VALUE,IP_LENGTH)) { - return false; - } - if(!CONFIG::write_buffer(EP_AP_MASK_VALUE,DEFAULT_MASK_VALUE,IP_LENGTH)) { - return false; - } - if(!CONFIG::write_buffer(EP_AP_GATEWAY_VALUE,DEFAULT_GATEWAY_VALUE,IP_LENGTH)) { - return false; - } - if(!CONFIG::write_byte(EP_AP_PHY_MODE,DEFAULT_PHY_MODE)) { - return false; - } - if(!CONFIG::write_byte(EP_SLEEP_MODE,DEFAULT_SLEEP_MODE)) { - return false; - } - if(!CONFIG::write_byte(EP_CHANNEL,DEFAULT_CHANNEL)) { - return false; - } - if(!CONFIG::write_byte(EP_AUTH_TYPE,DEFAULT_AUTH_TYPE)) { - return false; - } - if(!CONFIG::write_byte(EP_SSID_VISIBLE,DEFAULT_SSID_VISIBLE)) { - return false; - } - if(!CONFIG::write_buffer(EP_WEB_PORT,(const byte *)&DEFAULT_WEB_PORT,INTEGER_LENGTH)) { - return false; - } - if(!CONFIG::write_buffer(EP_DATA_PORT,(const byte *)&DEFAULT_DATA_PORT,INTEGER_LENGTH)) { - return false; - } - if(!CONFIG::write_byte(EP_REFRESH_PAGE_TIME,DEFAULT_REFRESH_PAGE_TIME)) { - return false; - } - if(!CONFIG::write_byte(EP_REFRESH_PAGE_TIME2,DEFAULT_REFRESH_PAGE_TIME)) { - return false; - } - if(!CONFIG::write_string(EP_HOSTNAME,wifi_config.get_default_hostname())) { - return false; - } - if(!CONFIG::write_buffer(EP_XY_FEEDRATE,(const byte *)&DEFAULT_XY_FEEDRATE,INTEGER_LENGTH)) { - return false; - } - if(!CONFIG::write_buffer(EP_Z_FEEDRATE,(const byte *)&DEFAULT_Z_FEEDRATE,INTEGER_LENGTH)) { - return false; - } - if(!CONFIG::write_buffer(EP_E_FEEDRATE,(const byte *)&DEFAULT_E_FEEDRATE,INTEGER_LENGTH)) { - return false; - } - if(!CONFIG::write_string(EP_ADMIN_PWD,FPSTR(DEFAULT_ADMIN_PWD))) { - return false; - } - if(!CONFIG::write_string(EP_USER_PWD,FPSTR(DEFAULT_USER_PWD))) { - return false; - } - - if(!CONFIG::write_byte(EP_TARGET_FW, UNKNOWN_FW)) { - return false; - } - - if(!CONFIG::write_byte(EP_TIMEZONE, DEFAULT_TIME_ZONE)) { - return false; - } - - if(!CONFIG::write_byte(EP_TIME_ISDST, DEFAULT_TIME_DST)) { - return false; - } - - if(!CONFIG::write_byte(EP_PRIMARY_SD, DEFAULT_PRIMARY_SD)) { - return false; - } - - if(!CONFIG::write_byte(EP_SECONDARY_SD, DEFAULT_SECONDARY_SD)) { - return false; - } - - if(!CONFIG::write_byte(EP_IS_DIRECT_SD, DEFAULT_IS_DIRECT_SD)) { - return false; - } - - if(!CONFIG::write_byte(EP_DIRECT_SD_CHECK, DEFAULT_DIRECT_SD_CHECK)) { - return false; - } - - if(!CONFIG::write_byte(EP_SD_CHECK_UPDATE_AT_BOOT, DEFAULT_SD_CHECK_UPDATE_AT_BOOT)) { - return false; - } - - if(!CONFIG::write_string(EP_TIME_SERVER1,FPSTR(DEFAULT_TIME_SERVER1))) { - return false; - } - - if(!CONFIG::write_string(EP_TIME_SERVER2,FPSTR(DEFAULT_TIME_SERVER2))) { - return false; - } - - if(!CONFIG::write_string(EP_TIME_SERVER3,FPSTR(DEFAULT_TIME_SERVER3))) { - return false; - } - return true; -} - -void CONFIG::print_config(tpipe output, bool plaintext) -{ - if (!plaintext)BRIDGE::print(F("{\"chip_id\":\""), output); - else BRIDGE::print(F("Chip ID: "), output); -#ifdef ARDUINO_ARCH_ESP8266 - BRIDGE::print(String(ESP.getChipId()).c_str(), output); -#else - BRIDGE::print(String((uint16_t)(ESP.getEfuseMac()>>32)).c_str(), output); -#endif - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"cpu\":\""), output); - else BRIDGE::print(F("CPU Frequency: "), output); - BRIDGE::print(String(ESP.getCpuFreqMHz()).c_str(), output); - if (plaintext)BRIDGE::print(F("Mhz"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); -#ifdef ARDUINO_ARCH_ESP32 - if (!plaintext)BRIDGE::print(F("\"cpu_temp\":\""), output); - else BRIDGE::print(F("CPU Temperature: "), output); - BRIDGE::print(String(temperatureRead(),1).c_str(), output); - if (plaintext)BRIDGE::print(F("C"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); -#endif - if (!plaintext)BRIDGE::print(F("\"freemem\":\""), output); - else BRIDGE::print(F("Free memory: "), output); - BRIDGE::print(formatBytes(ESP.getFreeHeap()).c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\""), output); - BRIDGE::print(F("SDK"), output); - if (!plaintext)BRIDGE::print(F("\":\""), output); - else BRIDGE::print(F(": "), output); - BRIDGE::print(ESP.getSdkVersion(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"flash_size\":\""), output); - else BRIDGE::print(F("Flash Size: "), output); - BRIDGE::print(formatBytes(ESP.getFlashChipSize()).c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); -#ifdef ARDUINO_ARCH_ESP8266 - fs::FSInfo info; - SPIFFS.info(info); - if (!plaintext)BRIDGE::print(F("\"update_size\":\""), output); - else BRIDGE::print(F("Available Size for update: "), output); - uint32_t flashsize = ESP.getFlashChipSize(); - if (flashsize > 1024 * 1024) flashsize = 1024 * 1024; - BRIDGE::print(formatBytes(flashsize - ESP.getSketchSize()-info.totalBytes).c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else { - if ((flashsize - ESP.getSketchSize()-info.totalBytes) > (ESP.getSketchSize())) BRIDGE::println(F("(Ok)"), output); - else BRIDGE::println(F("(Not enough)"), output); - } - - if (!plaintext)BRIDGE::print(F("\"spiffs_size\":\""), output); - else BRIDGE::print(F("Available Size for SPIFFS: "), output); - - BRIDGE::print(formatBytes(info.totalBytes).c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); -#else - if (!plaintext)BRIDGE::print(F("\"update_size\":\""), output); - else BRIDGE::print(F("Available Size for update: "), output); - uint32_t flashsize = ESP.getFlashChipSize(); -//Not OTA on 2Mb board per spec - if (flashsize > 0x20000) flashsize = 0x140000; - else flashsize = 0x0; - BRIDGE::print(formatBytes(flashsize).c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else { - if (flashsize > 0x0) BRIDGE::println(F("(Ok)"), output); - else BRIDGE::print(F("(Not enough)"), output); - } - if (!plaintext)BRIDGE::print(F("\"spiffs_size\":\""), output); - else BRIDGE::print(F("Available Size for SPIFFS: "), output); - BRIDGE::print(formatBytes(SPIFFS.totalBytes()).c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); -#endif - if (!plaintext)BRIDGE::print(F("\"baud_rate\":\""), output); - else BRIDGE::print(F("Baud rate: "), output); - uint32_t br = ESP_SERIAL_OUT.baudRate(); -#ifdef ARDUINO_ARCH_ESP32 - //workaround for ESP32 - if(br == 115201)br = 115200; - if(br == 230423)br = 230400; -#endif - BRIDGE::print(String(br).c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"sleep_mode\":\""), output); - else BRIDGE::print(F("Sleep mode: "), output); -#ifdef ARDUINO_ARCH_ESP32 - wifi_ps_type_t ps_type; - esp_wifi_get_ps(&ps_type); -#else - WiFiSleepType_t ps_type; - ps_type = WiFi.getSleepMode(); -#endif - if (ps_type == WIFI_NONE_SLEEP) { - BRIDGE::print(F("None"), output); -#ifdef ARDUINO_ARCH_ESP8266 - } else if (ps_type == WIFI_LIGHT_SLEEP) { - BRIDGE::print(F("Light"), output); -#endif - } else if (ps_type == WIFI_MODEM_SLEEP) { - BRIDGE::print(F("Modem"), output); - } else { - BRIDGE::print(F("???"), output); - } - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"channel\":\""), output); - else BRIDGE::print(F("Channel: "), output); - BRIDGE::print(String(WiFi.channel()).c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); -#ifdef ARDUINO_ARCH_ESP32 - uint8_t PhyMode; - if (WiFi.getMode() == WIFI_STA)esp_wifi_get_protocol(ESP_IF_WIFI_STA, &PhyMode); - else esp_wifi_get_protocol(ESP_IF_WIFI_AP, &PhyMode); -#else - WiFiPhyMode_t PhyMode = WiFi.getPhyMode(); -#endif - if (!plaintext)BRIDGE::print(F("\"phy_mode\":\""), output); - else BRIDGE::print(F("Phy Mode: "), output); - if (PhyMode == (WIFI_PHY_MODE_11G))BRIDGE::print(F("11g"), output); - else if (PhyMode == (WIFI_PHY_MODE_11B))BRIDGE::print(F("11b"), output); - else if (PhyMode == (WIFI_PHY_MODE_11N))BRIDGE::print(F("11n"), output); - else BRIDGE::print(F("???"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"web_port\":\""), output); - else BRIDGE::print(F("Web port: "), output); - BRIDGE::print(String(wifi_config.iweb_port).c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"data_port\":\""), output); - else BRIDGE::print(F("Data port: "), output); -#ifdef TCP_IP_DATA_FEATURE - BRIDGE::print(String(wifi_config.idata_port).c_str(), output); -#else - BRIDGE::print(F("Disabled"), output); -#endif - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (WiFi.getMode() == WIFI_STA || WiFi.getMode() == WIFI_AP_STA) { - if (!plaintext)BRIDGE::print(F("\"hostname\":\""), output); - else BRIDGE::print(F("Hostname: "), output); -#ifdef ARDUINO_ARCH_ESP32 - BRIDGE::print(WiFi.getHostname(), output); -#else - BRIDGE::print(WiFi.hostname().c_str(), output); -#endif - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - } - - if (!plaintext)BRIDGE::print(F("\"active_mode\":\""), output); - else BRIDGE::print(F("Active Mode: "), output); - if (WiFi.getMode() == WIFI_STA) { - BRIDGE::print(F("Station ("), output); - BRIDGE::print(WiFi.macAddress().c_str(), output); - BRIDGE::print(F(")"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - if (WiFi.isConnected()) { - if (!plaintext)BRIDGE::print(F("\"connected_ssid\":\""), output); - else BRIDGE::print(F("Connected to: "), output); - BRIDGE::print(WiFi.SSID().c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - if (!plaintext)BRIDGE::print(F("\"connected_signal\":\""), output); - else BRIDGE::print(F("Signal: "), output); - BRIDGE::print(String(wifi_config.getSignal(WiFi.RSSI())).c_str(), output); - BRIDGE::print(F("%"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - } - else { - if (!plaintext)BRIDGE::print(F("\"connection_status\":\""), output); - else BRIDGE::print(F("Connection Status: "), output); - BRIDGE::print(F("Connection Status: "), output); - if (WiFi.status() == WL_DISCONNECTED) { - BRIDGE::print(F("Disconnected"), output); - } else if (WiFi.status() == WL_CONNECTION_LOST) { - BRIDGE::print(F("Connection lost"), output); - } else if (WiFi.status() == WL_CONNECT_FAILED) { - BRIDGE::print(F("Connection failed"), output); - } else if (WiFi.status() == WL_NO_SSID_AVAIL) { - BRIDGE::print(F("No connection"), output); - } else if (WiFi.status() == WL_IDLE_STATUS ) { - BRIDGE::print(F("Idle"), output); - } else BRIDGE::print(F("Unknown"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - } - if (!plaintext)BRIDGE::print(F("\"ip_mode\":\""), output); - else BRIDGE::print(F("IP Mode: "), output); -#ifdef ARDUINO_ARCH_ESP32 - tcpip_adapter_dhcp_status_t dhcp_status; - tcpip_adapter_dhcpc_get_status(TCPIP_ADAPTER_IF_STA, &dhcp_status); - if (dhcp_status == TCPIP_ADAPTER_DHCP_STARTED) -#else - if (wifi_station_dhcpc_status()==DHCP_STARTED) -#endif - { - BRIDGE::print(F("DHCP"), output); - } - else BRIDGE::print(F("Static"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"ip\":\""), output); - else BRIDGE::print(F("IP: "), output); - BRIDGE::print(WiFi.localIP().toString().c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"gw\":\""), output); - else BRIDGE::print(F("Gateway: "), output); - BRIDGE::print(WiFi.gatewayIP().toString().c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"msk\":\""), output); - else BRIDGE::print(F("Mask: "), output); - BRIDGE::print(WiFi.subnetMask().toString().c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"dns\":\""), output); - else BRIDGE::print(F("DNS: "), output); - BRIDGE::print(WiFi.dnsIP().toString().c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"disabled_mode\":\""), output); - else BRIDGE::print(F("Disabled Mode: "), output); - BRIDGE::print(F("Access Point ("), output); - BRIDGE::print(WiFi.softAPmacAddress().c_str(), output); - BRIDGE::print(F(")"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - } else if (WiFi.getMode() == WIFI_AP) { - BRIDGE::print(F("Access Point ("), output); - BRIDGE::print(WiFi.softAPmacAddress().c_str(), output); - BRIDGE::print(F(")"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - //get current config -#ifdef ARDUINO_ARCH_ESP32 - wifi_ap_config_t apconfig; - wifi_config_t conf; - esp_wifi_get_config(ESP_IF_WIFI_AP, &conf); - apconfig.ssid_hidden = conf.ap.ssid_hidden; - apconfig.authmode = conf.ap.authmode; - apconfig.max_connection = conf.ap.max_connection; -#else - struct softap_config apconfig; - wifi_softap_get_config(&apconfig); -#endif - if (!plaintext)BRIDGE::print(F("\"ap_ssid\":\""), output); - else BRIDGE::print(F("SSID: "), output); -#ifdef ARDUINO_ARCH_ESP32 - BRIDGE::print((const char*)conf.ap.ssid, output); -#else - BRIDGE::print((const char*)apconfig.ssid, output); -#endif - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"ssid_visible\":\""), output); - else BRIDGE::print(F("Visible: "), output); - BRIDGE::print((apconfig.ssid_hidden == 0)?F("Yes"):F("No"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"ssid_authentication\":\""), output); - else BRIDGE::print(F("Authentication: "), output); - if (apconfig.authmode==AUTH_OPEN) { - BRIDGE::print(F("None"), output); - } else if (apconfig.authmode==AUTH_WEP) { - BRIDGE::print(F("WEP"), output); - } else if (apconfig.authmode==AUTH_WPA_PSK) { - BRIDGE::print(F("WPA"), output); - } else if (apconfig.authmode==AUTH_WPA2_PSK) { - BRIDGE::print(F("WPA2"), output); - } else { - BRIDGE::print(F("WPA/WPA2"), output); - } - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"ssid_max_connections\":\""), output); - else BRIDGE::print(F("Max Connections: "), output); - BRIDGE::print(String(apconfig.max_connection).c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"ssid_dhcp\":\""), output); - else BRIDGE::print(F("DHCP Server: "), output); -#ifdef ARDUINO_ARCH_ESP32 - tcpip_adapter_dhcp_status_t dhcp_status; - tcpip_adapter_dhcps_get_status(TCPIP_ADAPTER_IF_AP, &dhcp_status); - if (dhcp_status == TCPIP_ADAPTER_DHCP_STARTED) -#else - if(wifi_softap_dhcps_status() == DHCP_STARTED) -#endif - { - BRIDGE::print(F("Started"), output); - } - else BRIDGE::print(F("Stopped"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"ip\":\""), output); - else BRIDGE::print(F("IP: "), output); - BRIDGE::print(WiFi.softAPIP().toString().c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); -#ifdef ARDUINO_ARCH_ESP32 - tcpip_adapter_ip_info_t ip; - tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_AP, &ip); -#else - struct ip_info ip; - wifi_get_ip_info(SOFTAP_IF, &ip); -#endif - if (!plaintext)BRIDGE::print(F("\"gw\":\""), output); - else BRIDGE::print(F("Gateway: "), output); - BRIDGE::print(IPAddress(ip.gw.addr).toString().c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"msk\":\""), output); - else BRIDGE::print(F("Mask: "), output); - BRIDGE::print(IPAddress(ip.netmask.addr).toString().c_str(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - - if (!plaintext)BRIDGE::print(F("\"connected_clients\":["), output); - else BRIDGE::print(F("Connected clients: "), output); - int client_counter=0; -#ifdef ARDUINO_ARCH_ESP32 - wifi_sta_list_t station; - tcpip_adapter_sta_list_t tcpip_sta_list; - esp_wifi_ap_get_sta_list(&station); - tcpip_adapter_get_sta_list(&station, &tcpip_sta_list); -#else - struct station_info * station; - station = wifi_softap_get_station_info(); -#endif - String stmp =""; -#ifdef ARDUINO_ARCH_ESP32 - for (int i=0; i < station.num; i++){ -#else - while(station) { -#endif - if(stmp.length() > 0) { - if (!plaintext)stmp+=F(","); - else stmp+=F("\n"); - - } - if (!plaintext)stmp+=F("{\"bssid\":\""); - //BSSID -#ifdef ARDUINO_ARCH_ESP32 - stmp += CONFIG::mac2str(tcpip_sta_list.sta[i].mac); -#else - stmp += CONFIG::mac2str(station->bssid); -#endif - if (!plaintext)stmp+=F("\",\"ip\":\""); - else stmp += F(" "); - //IP -#ifdef ARDUINO_ARCH_ESP32 - stmp += IPAddress(tcpip_sta_list.sta[i].ip.addr).toString().c_str(); -#else - stmp += IPAddress((const uint8_t *)&station->ip).toString().c_str(); -#endif - if (!plaintext)stmp+=F("\"}"); - //increment counter - client_counter++; -#ifdef ARDUINO_ARCH_ESP32 - } -#else - //go next record - station =STAILQ_NEXT(station, next); - } - wifi_softap_free_station_info(); -#endif - if (!plaintext) { - BRIDGE::print(stmp.c_str(), output); - BRIDGE::print(F("],"), output); - } - else { - //display number of client - BRIDGE::println(String(client_counter).c_str(), output); - //display list if any - if(stmp.length() > 0)BRIDGE::println(stmp.c_str(), output); - } - - if (!plaintext)BRIDGE::print(F("\"disabled_mode\":\""), output); - else BRIDGE::print(F("Disabled Mode: "), output); - BRIDGE::print(F("Station ("), output); - BRIDGE::print(WiFi.macAddress().c_str(), output); - BRIDGE::print(F(") is disabled"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - } else if (WiFi.getMode() == WIFI_AP_STA) { - BRIDGE::print(F("Mixed"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - if (!plaintext)BRIDGE::print(F("\"active_mode\":\""), output); - else BRIDGE::print(F("Active Mode: "), output); - BRIDGE::print(F("Access Point ("), output); - BRIDGE::print(WiFi.softAPmacAddress().c_str(), output); - BRIDGE::println(F(")"), output); - BRIDGE::print(F("Station ("), output); - BRIDGE::print(WiFi.macAddress().c_str(), output); - BRIDGE::print(F(")"), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - } else { - BRIDGE::print("Wifi Off", output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - } - - if (!plaintext)BRIDGE::print(F("\"captive_portal\":\""), output); - else BRIDGE::print(F("Captive portal: "), output); -#ifdef CAPTIVE_PORTAL_FEATURE - BRIDGE::print(F("Enabled"), output); -#else - BRIDGE::print(F("Disabled"), output); -#endif - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"ssdp\":\""), output); - else BRIDGE::print(F("SSDP: "), output); -#ifdef SSDP_FEATURE - BRIDGE::print(F("Enabled"), output); -#else - BRIDGE::print(F("Disabled"), output); -#endif - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"netbios\":\""), output); - else BRIDGE::print(F("NetBios: "), output); -#ifdef NETBIOS_FEATURE - BRIDGE::print(F("Enabled"), output); -#else - BRIDGE::print(F("Disabled"), output); -#endif - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"mdns\":\""), output); - else BRIDGE::print(F("mDNS: "), output); -#ifdef MDNS_FEATURE - BRIDGE::print(F("Enabled"), output); -#else - BRIDGE::print(F("Disabled"), output); -#endif - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"web_update\":\""), output); - else BRIDGE::print(F("Web Update: "), output); -#ifdef WEB_UPDATE_FEATURE - BRIDGE::print(F("Enabled"), output); -#else - BRIDGE::print(F("Disabled"), output); -#endif - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"pin recovery\":\""), output); - else BRIDGE::print(F("Pin Recovery: "), output); -#ifdef RECOVERY_FEATURE - BRIDGE::print(F("Enabled"), output); -#else - BRIDGE::print(F("Disabled"), output); -#endif - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"autentication\":\""), output); - else BRIDGE::print(F("Authentication: "), output); -#ifdef AUTHENTICATION_FEATURE - BRIDGE::print(F("Enabled"), output); -#else - BRIDGE::print(F("Disabled"), output); -#endif - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); - - if (!plaintext)BRIDGE::print(F("\"target_fw\":\""), output); - else BRIDGE::print(F("Target Firmware: "), output); - BRIDGE::print(CONFIG::GetFirmwareTargetName(), output); - if (!plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); -#ifdef DEBUG_ESP3D - if (!plaintext)BRIDGE::print(F("\"debug\":\""), output); - else BRIDGE::print(F("Debug: "), output); - BRIDGE::print(F("Debug Enabled :"), output); -#ifdef DEBUG_OUTPUT_SPIFFS - BRIDGE::print(F("SPIFFS"), output); -#endif -#ifdef DEBUG_OUTPUT_SD - BRIDGE::print(F("SD"), output); -#endif -#ifdef DEBUG_OUTPUT_SERIAL - BRIDGE::print(F("serial"), output); -#endif -#ifdef DEBUG_OUTPUT_TCP - BRIDGE::print(F("TCP"), output); -#endif - if (plaintext)BRIDGE::print(F("\","), output); - else BRIDGE::print(F("\n"), output); -#endif - if (!plaintext)BRIDGE::print(F("\"fw\":\""), output); - else BRIDGE::print(F("FW version: "), output); - BRIDGE::print(FW_VERSION, output); - if (!plaintext)BRIDGE::print(F("\"}"), output); - else BRIDGE::print(F("\n"), output); -} diff --git a/esp3d/config.h b/esp3d/config.h deleted file mode 100644 index ec02dc4b..00000000 --- a/esp3d/config.h +++ /dev/null @@ -1,430 +0,0 @@ -/* - config.h - ESP3D configuration class - - Copyright (c) 2014 Luc Lebosse. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -//definition -#define UNKNOWN_FW 0 -#define REPETIER4DV 1 -#define MARLIN 2 -#define MARLINKIMBRA 3 -#define SMOOTHIEWARE 4 -#define REPETIER 5 - -#ifdef ARDUINO_ARCH_ESP32 -#include "FS.h" -#include "SPIFFS.h" -#define WIFI_NONE_SLEEP WIFI_PS_NONE -#define WIFI_MODEM_SLEEP WIFI_PS_MAX_MODEM -#define WIFI_PHY_MODE_11B WIFI_PROTOCOL_11B -#define WIFI_PHY_MODE_11G WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G -#define WIFI_PHY_MODE_11N WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N -#define AUTH_OPEN WIFI_AUTH_OPEN -#define AUTH_WEP WIFI_AUTH_WEP -#define AUTH_WPA_PSK WIFI_AUTH_WPA_PSK -#define AUTH_WPA2_PSK WIFI_AUTH_WPA2_PSK -#define AUTH_WPA_WPA2_PSK WIFI_AUTH_WPA_WPA2_PSK -#define ENC_TYPE_NONE AUTH_OPEN -#define FS_FILE File -#define FS_DIR File -#define ESP_SERIAL_OUT Serial -#define SD_FILE_READ FILE_READ -#define SPIFFS_FILE_READ FILE_READ -#define SD_FILE_WRITE FILE_WRITE -#define SPIFFS_FILE_WRITE FILE_WRITE -#else -#define FS_DIR fs::Dir -#define FS_FILE fs::File -#define ESP_SERIAL_OUT Serial -#define SD_FILE_READ FILE_READ -#define SPIFFS_FILE_READ "r" -#define SD_FILE_WRITE FILE_WRITE -#define SPIFFS_FILE_WRITE "w" -#endif - -#define MAX_FW_ID REPETIER - -//number of clients allowed to use data port at once -#define MAX_SRV_CLIENTS 1 - -//comment to disable -//MDNS_FEATURE: this feature allow type the name defined -//in web browser by default: http:\\esp8266.local and connect -#define MDNS_FEATURE - -//SSDD_FEATURE: this feature is a discovery protocol, supported on Windows out of the box -#define SSDP_FEATURE - -//NETBIOS_FEATURE: this feature is a discovery protocol, supported on Windows out of the box -#define NETBIOS_FEATURE - -#ifdef ARDUINO_ARCH_ESP32 -#ifdef SSDP_FEATURE -#undef SSDP_FEATURE -#endif -#ifdef NETBIOS_FEATURE -#undef NETBIOS_FEATURE -#endif -#endif - -//CAPTIVE_PORTAL_FEATURE: In SoftAP redirect all unknow call to main page -#define CAPTIVE_PORTAL_FEATURE - -//AUTHENTICATION_FEATURE: protect pages by login password -//#define AUTHENTICATION_FEATURE - -//WEB_UPDATE_FEATURE: allow to flash fw using web UI -#define WEB_UPDATE_FEATURE - -//SERIAL_COMMAND_FEATURE: allow to send command by serial -#define SERIAL_COMMAND_FEATURE - -//TCP_IP_DATA_FEATURE: allow to connect serial from TCP/IP -#define TCP_IP_DATA_FEATURE - -//RECOVERY_FEATURE: allow to use GPIO2 pin as hardware reset for EEPROM, add 8s to boot time to let user to jump GPIO2 to GND -//#define RECOVERY_FEATURE - -#ifdef RECOVERY_FEATURE -//pin used to reset setting -#define RESET_CONFIG_PIN 2 -#endif - -//DIRECT_PIN_FEATURE: allow to access pin using ESP201 command -#define DIRECT_PIN_FEATURE - -//INFO_MSG_FEATURE: catch the Info msg and filter it to specific table -#define INFO_MSG_FEATURE - -//ERROR_MSG_FEATURE: catch the error msg and filter it to specific table -#define ERROR_MSG_FEATURE - -//STATUS_MSG_FEATURE: catch the status msg and filter it to specific table -#define STATUS_MSG_FEATURE - -//Serial rx buffer size is 256 but can be extended -#define SERIAL_RX_BUFFER_SIZE 512 - -#ifdef ARDUINO_ARCH_ESP32 -#ifdef SSDP_FEATURE -#undef SSDP_FEATURE -#endif -#ifdef NETBIOS_FEATURE -#undef NETBIOS_FEATURE -#endif -#endif - - -//DEBUG Flag do not do this when connected to printer !!! -//be noted all upload may failed if enabled -//#define DEBUG_ESP3D -//#define DEBUG_OUTPUT_SPIFFS -//#define DEBUG_OUTPUT_SERIAL -//#define DEBUG_OUTPUT_TCP - -//store performance result in storestring variable : info_msg / status_msg -//#define DEBUG_PERFORMANCE -#define DEBUG_PERF_VARIABLE (web_interface->info_msg) -/* -#ifndef FS_NO_GLOBALS -#define FS_NO_GLOBALS -#endif -#include -#define DEBUG_ESP3D(string) { FS_FILE logfile = SPIFFS.open("/log.txt", "a+");logfile.print(string);logfile.close();} -*/ - -#ifdef DEBUG_ESP3D -#ifdef DEBUG_OUTPUT_SPIFFS -#ifndef FS_NO_GLOBALS -#define FS_NO_GLOBALS -#endif -#include -#define DEBUG_PIPE NO_PIPE -#define LOG(string) { FS_FILE logfile = SPIFFS.open("/log.txt", "a+");logfile.print(string);logfile.close();} -#endif -#ifdef DEBUG_OUTPUT_SERIAL -#define LOG(string) {ESP_SERIAL_OUT.print(string);} -#define DEBUG_PIPE SERIAL_PIPE -#endif -#ifdef DEBUG_OUTPUT_TCP -#include "bridge.h" -#define LOG(string) {BRIDGE::send2TCP(string);} -#define DEBUG_PIPE TCP_PIPE -#endif -#else -#define LOG(string) {} -#define DEBUG_PIPE NO_PIPE -#endif - -#ifndef CONFIG_h -#define CONFIG_h - -#include -#ifdef ARDUINO_ARCH_ESP8266 -extern "C" { -#include "user_interface.h" -} -#else -//Nothing here -#endif -#include "wificonf.h" -//version and sources location -#define FW_VERSION "1.0" -#define REPOSITORY "https://github.com/luc-github/ESP3D" - -typedef enum { - NO_PIPE = 0, - SERIAL_PIPE = 2, - SERIAL1_PIPE = 3, -#ifdef TCP_IP_DATA_FEATURE - TCP_PIPE = 4, -#endif - WEB_PIPE = 5 -} tpipe; - -typedef enum { - LEVEL_GUEST = 0, - LEVEL_USER = 1, - LEVEL_ADMIN = 2 -} level_authenticate_type; - - -#define NO_SD 0 -#define SD_DIRECTORY 1 -#define EXT_DIRECTORY 2 - - -//flags -#define AP_MODE 1 -#define CLIENT_MODE 2 -#define DHCP_MODE 1 -#define STATIC_IP_MODE 2 - -//position in EEPROM -//AP mode = 1; Station client mode = 2 -#define EP_WIFI_MODE 0 //1 byte = flag -#define EP_STA_SSID 1 //33 bytes 32+1 = string ; warning does not support multibyte char like chinese -#define EP_STA_PASSWORD 34 //65 bytes 64 +1 = string ;warning does not support multibyte char like chinese -#define EP_STA_IP_MODE 99 //1 byte = flag -#define EP_STA_IP_VALUE 100 //4 bytes xxx.xxx.xxx.xxx -#define EP_STA_MASK_VALUE 104 //4 bytes xxx.xxx.xxx.xxx -#define EP_STA_GATEWAY_VALUE 108 //4 bytes xxx.xxx.xxx.xxx -#define EP_BAUD_RATE 112 //4 bytes = int -#define EP_STA_PHY_MODE 116 //1 byte = flag -#define EP_SLEEP_MODE 117 //1 byte = flag -#define EP_CHANNEL 118 //1 byte = flag -#define EP_AUTH_TYPE 119 //1 byte = flag -#define EP_SSID_VISIBLE 120 //1 byte = flag -#define EP_WEB_PORT 121 //4 bytes = int -#define EP_DATA_PORT 125 //4 bytes = int -#define EP_REFRESH_PAGE_TIME 129 //1 bytes = flag -#define EP_HOSTNAME 130//33 bytes 32+1 = string ; warning does not support multibyte char like chinese -#define EP_XY_FEEDRATE 164//4 bytes = int -#define EP_Z_FEEDRATE 168//4 bytes = int -#define EP_E_FEEDRATE 172//4 bytes = int -#define EP_ADMIN_PWD 176//21 bytes 20+1 = string ; warning does not support multibyte char like chinese -#define EP_USER_PWD 197//21 bytes 20+1 = string ; warning does not support multibyte char like chinese -#define EP_AP_SSID 218 //33 bytes 32+1 = string ; warning does not support multibyte char like chinese -#define EP_AP_PASSWORD 251 //65 bytes 64 +1 = string ;warning does not support multibyte char like chinese -#define EP_AP_IP_VALUE 316 //4 bytes xxx.xxx.xxx.xxx -#define EP_AP_MASK_VALUE 320 //4 bytes xxx.xxx.xxx.xxx -#define EP_AP_GATEWAY_VALUE 324 //4 bytes xxx.xxx.xxx.xxx -#define EP_AP_IP_MODE 329 //1 byte = flag -#define EP_AP_PHY_MODE 330 //1 byte = flag -#define EP_DATA_STRING 331 //129 bytes 128+1 = string ; warning does not support multibyte char like chinese -#define EP_REFRESH_PAGE_TIME2 460 //1 bytes = flag -#define EP_TARGET_FW 461 //1 bytes = flag -#define EP_TIMEZONE 462//1 bytes = flag -#define EP_TIME_ISDST 463//1 bytes = flag -#define EP_TIME_SERVER1 464//129 bytes 128+1 = string ; warning does not support multibyte char like chinese -#define EP_TIME_SERVER2 593 //129 bytes 128+1 = string ; warning does not support multibyte char like chinese -#define EP_TIME_SERVER3 722 //129 bytes 128+1 = string ; warning does not support multibyte char like chinese -#define EP_IS_DIRECT_SD 850//1 bytes = flag -#define EP_PRIMARY_SD 851//1 bytes = flag -#define EP_SECONDARY_SD 852//1 bytes = flag -#define EP_DIRECT_SD_CHECK 853//1 bytes = flag -#define EP_SD_CHECK_UPDATE_AT_BOOT 854//1 bytes = flag - -#define LAST_EEPROM_ADDRESS 855 -//next available is 855 -//space left 1024 - 855 = 169 - -//default values -#define DEFAULT_WIFI_MODE AP_MODE -const char DEFAULT_AP_SSID [] PROGMEM = "ESP3D"; -const char DEFAULT_AP_PASSWORD [] PROGMEM = "12345678"; -const char DEFAULT_STA_SSID [] PROGMEM = "ESP3D"; -const char DEFAULT_STA_PASSWORD [] PROGMEM = "12345678"; -const byte DEFAULT_STA_IP_MODE = DHCP_MODE; -const byte DEFAULT_AP_IP_MODE = STATIC_IP_MODE; -const byte DEFAULT_IP_VALUE[] = {192, 168, 0, 1}; -const byte DEFAULT_MASK_VALUE[] = {255, 255, 255, 0}; -#define DEFAULT_GATEWAY_VALUE DEFAULT_IP_VALUE -const long DEFAULT_BAUD_RATE = 115200; -const char M117_[] PROGMEM = "M117 "; -#define DEFAULT_PHY_MODE WIFI_PHY_MODE_11G -#define DEFAULT_SLEEP_MODE WIFI_MODEM_SLEEP -#define DEFAULT_CHANNEL 11 -#define DEFAULT_AUTH_TYPE AUTH_WPA_PSK -#define DEFAULT_SSID_VISIBLE 1 -#define DEFAULT_MAX_CONNECTIONS 4 -#define DEFAULT_BEACON_INTERVAL 100 -const int DEFAULT_WEB_PORT = 80; -const int DEFAULT_DATA_PORT = 8888; -#define DEFAULT_REFRESH_PAGE_TIME 3 -const int DEFAULT_XY_FEEDRATE=1000; -const int DEFAULT_Z_FEEDRATE =100; -const int DEFAULT_E_FEEDRATE=400; -const char DEFAULT_ADMIN_PWD [] PROGMEM = "admin"; -const char DEFAULT_USER_PWD [] PROGMEM = "user"; -const char DEFAULT_ADMIN_LOGIN [] PROGMEM = "admin"; -const char DEFAULT_USER_LOGIN [] PROGMEM = "user"; -const char DEFAULT_TIME_SERVER1 [] PROGMEM = "time.nist.gov"; -const char DEFAULT_TIME_SERVER2 [] PROGMEM = "0.pool.ntp.org"; -const char DEFAULT_TIME_SERVER3 [] PROGMEM = "1.pool.ntp.org"; -#define DEFAULT_TIME_ZONE 0 -#define DEFAULT_TIME_DST 0 -#define DEFAULT_PRIMARY_SD 1 -#define DEFAULT_SECONDARY_SD 2 -#define DEFAULT_DIRECT_SD_CHECK 0 -#define DEFAULT_SD_CHECK_UPDATE_AT_BOOT 1 - - -#define DEFAULT_IS_DIRECT_SD 0 - - - - -const uint16_t Setting[][2] = { - {EP_WIFI_MODE, LEVEL_ADMIN},//0 - {EP_STA_SSID, LEVEL_ADMIN},//1 - {EP_STA_PASSWORD, LEVEL_ADMIN},//2 - {EP_STA_IP_MODE, LEVEL_ADMIN},//3 - {EP_STA_IP_VALUE, LEVEL_ADMIN},//4 - {EP_STA_MASK_VALUE, LEVEL_ADMIN},//5 - {EP_STA_GATEWAY_VALUE, LEVEL_ADMIN},//6 - {EP_BAUD_RATE, LEVEL_ADMIN},//7 - {EP_STA_PHY_MODE, LEVEL_ADMIN},//8 - {EP_SLEEP_MODE, LEVEL_ADMIN},//9 - {EP_CHANNEL, LEVEL_ADMIN},//10 - {EP_AUTH_TYPE, LEVEL_ADMIN},//11 - {EP_SSID_VISIBLE, LEVEL_ADMIN},//12 - {EP_WEB_PORT, LEVEL_ADMIN},//13 - {EP_DATA_PORT, LEVEL_ADMIN},//14 - {EP_REFRESH_PAGE_TIME, LEVEL_USER},//15 - {EP_HOSTNAME, LEVEL_ADMIN},//16 - {EP_XY_FEEDRATE, LEVEL_USER},//17 - {EP_Z_FEEDRATE, LEVEL_USER},//18 - {EP_E_FEEDRATE, LEVEL_USER},//19 - {EP_ADMIN_PWD, LEVEL_ADMIN},//20 - {EP_USER_PWD, LEVEL_USER},//21 - {EP_AP_SSID, LEVEL_ADMIN},//22 - {EP_AP_PASSWORD, LEVEL_ADMIN},//23 - {EP_AP_IP_VALUE, LEVEL_ADMIN},//24 - {EP_AP_MASK_VALUE, LEVEL_ADMIN},//25 - {EP_AP_GATEWAY_VALUE, LEVEL_ADMIN},//26 - {EP_AP_IP_MODE, LEVEL_ADMIN},//27 - {EP_AP_PHY_MODE, LEVEL_ADMIN},//28 - {EP_DATA_STRING, LEVEL_USER},//29 - {EP_REFRESH_PAGE_TIME2, LEVEL_USER},//30 - {EP_TARGET_FW, LEVEL_USER},//31 - {EP_TIMEZONE, LEVEL_USER},//32 - {EP_TIME_ISDST, LEVEL_USER},//33 - {EP_TIME_SERVER1, LEVEL_USER},//34 - {EP_TIME_SERVER2, LEVEL_USER},//35 - {EP_TIME_SERVER3, LEVEL_USER},//36 - {EP_IS_DIRECT_SD, LEVEL_USER},//37 - {EP_PRIMARY_SD, LEVEL_USER},//38 - {EP_SECONDARY_SD, LEVEL_USER},//39 - {EP_DIRECT_SD_CHECK, LEVEL_USER}, //40 - {EP_SD_CHECK_UPDATE_AT_BOOT, LEVEL_USER} //41 -}; -#define AUTH_ENTRY_NB 42 -//values -#define DEFAULT_MAX_REFRESH 120 -#define DEFAULT_MIN_REFRESH 0 -#define DEFAULT_MAX_XY_FEEDRATE 9999 -#define DEFAULT_MIN_XY_FEEDRATE 1 -#define DEFAULT_MAX_Z_FEEDRATE 9999 -#define DEFAULT_MIN_Z_FEEDRATE 1 -#define DEFAULT_MAX_E_FEEDRATE 9999 -#define DEFAULT_MIN_E_FEEDRATE 1 -#define DEFAULT_MAX_WEB_PORT 65001 -#define DEFAULT_MIN_WEB_PORT 1 -#define DEFAULT_MAX_DATA_PORT 65001 -#define DEFAULT_MIN_DATA_PORT 1 - -#define MAX_TRY 2000 - -//sizes -#define EEPROM_SIZE 1024 //max is 1024 -#define MAX_SSID_LENGTH 32 -#define MIN_SSID_LENGTH 1 -#define MAX_PASSWORD_LENGTH 64 -//min size of password is 0 or upper than 8 char -//so let set min is 0 -#define MIN_PASSWORD_LENGTH 0 -#define MAX_LOCAL_PASSWORD_LENGTH 16 -#define MIN_LOCAL_PASSWORD_LENGTH 1 -#define MAX_DATA_LENGTH 128 -#define MIN_DATA_LENGTH 0 -#define IP_LENGTH 4 -#define INTEGER_LENGTH 4 -#define MAX_HOSTNAME_LENGTH 32 -#define MIN_HOSTNAME_LENGTH 1 -#define WL_MAC_ADDR_LENGTH 6 - -class CONFIG -{ -public: - static bool is_direct_sd; - static bool read_string(int pos, char byte_buffer[], int size_max); - static bool read_string(int pos, String & sbuffer, int size_max); - static bool read_buffer(int pos, byte byte_buffer[], int size_buffer); - static bool read_byte(int pos, byte * value); - static bool write_string(int pos, const char * byte_buffer); - static bool write_string(int pos, const __FlashStringHelper *str); - static bool write_buffer(int pos, const byte * byte_buffer, int size_buffer); - static bool write_byte(int pos, const byte value); - static bool reset_config(); - static void print_config(tpipe output, bool plaintext); - static bool SetFirmwareTarget(uint8_t fw); - static void InitFirmwareTarget(); - static void InitDirectSD(); - static void InitPins(); - static bool InitBaudrate(); - static bool InitExternalPorts(); - static bool check_update_presence(); - static uint8_t GetFirmwareTarget(); - static const char* GetFirmwareTargetName(); - static const char* GetFirmwareTargetShortName(); - static bool isHostnameValid(const char * hostname); - static bool isSSIDValid(const char * ssid); - static bool isPasswordValid(const char * password); - static bool isLocalPasswordValid(const char * password); - static bool isIPValid(const char * IP); - static char * intTostr(int value); - static String formatBytes(uint32_t bytes); - static char * mac2str(uint8_t mac [WL_MAC_ADDR_LENGTH]); - static byte split_ip (const char * ptr,byte * part); - static void esp_restart(); -private: - static uint8_t FirmwareTarget; -}; - -#endif diff --git a/esp3d/data/404.htm b/esp3d/data/404.htm deleted file mode 100644 index a1dec29a..00000000 --- a/esp3d/data/404.htm +++ /dev/null @@ -1,18 +0,0 @@ - - -404 page - - -
-

- - - - -404 Error, unknown page!

-

What are you doing here ?

-You are not supposed to find this location... -
- - - diff --git a/esp3d/data/favicon.ico b/esp3d/data/favicon.ico deleted file mode 100644 index b2b24df700f4915e446e0dbcaa7be6a9795b43ac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmdUvy-EX75QR_HfFTGjK~e=tk-}135sQFZEWxc$44y(Rbkn2Epe!1Gt6mPjk?0z%vwZA8_v4=68O29XNtzScg-1 z3OIMoJ!?9j=TP$=<30QIYb8yMULU+4Yy51JMP7#<7ggd2-oP5)`#j*>HTOnA+atGk z7u-966xP7!9`EIzbJteE8f#s*w*{Bs`i{5_OWquD!Gyd?z5{XY1$nEa^SSu{68Gtu zJ~!h$K9@DtPUhMl7d8I|2XF;ZALqH|-j}nF{&Ga;vuOwF<=$WBMIo8@J?V988Xpg( ahehdZP8yGShlKY=l1uv)>3V*uweJHpiklAr diff --git a/esp3d/data/index.html.gz b/esp3d/data/index.html.gz deleted file mode 100644 index 8ed88ab79d1d30af47a66936586e2f73312d9416..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 79777 zcmaHyV{m3o*S2FP6Wg|}iFL)cZQHhO+qP{x6I&BI`R0CpzxDO6KC7$O-o4JQ>e{Q1 zO%MeI^uGpk)$`^?GL}I2`O(| z)vYTtbugV}!{O2pK)n0;9cAdN^j9d$TgThMwT)W$w)I0Z(5okNZHnP!WXDqV^=M4L zMPsF^`>{$x7hNydzfgC@#Np|Kz%RV-`MW6n`#5WE&SLR&#ky~EMa}K)Pu0VhjDjA6 z>c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