diff --git a/PasswordDialogBox.png b/PasswordDialogBox.png new file mode 100644 index 0000000..9cc2d87 Binary files /dev/null and b/PasswordDialogBox.png differ diff --git a/README.md b/README.md index 9e96c09..940714c 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ On the OS X create the tools directory in ~/Documents/Arduino/ and unpack the fi ![Screenshot](screenshot.png) +![DialogBox](PasswordDialogBox.png) + ## Credits and license - Copyright (c) 2015 Hristo Gochkov (ficeto at ficeto dot com) diff --git a/esp8266littlefs.jar b/esp8266littlefs.jar new file mode 100644 index 0000000..363f527 Binary files /dev/null and b/esp8266littlefs.jar differ diff --git a/makeLittleFS.bat b/makeLittleFS.bat new file mode 100644 index 0000000..0447df8 --- /dev/null +++ b/makeLittleFS.bat @@ -0,0 +1,46 @@ +ECHO off + +REM set pde_path=C:/temp/JavaTrials/Arduino-master/build/windows/work/lib/pde.jar +REM set pde_path=C:/temp/JavaTrials/Arduino-master/app/pde.jar +set pde_path=D:/Program Files (x86)/Arduino/lib/pde.jar + +REM set core_path=C:/temp/JavaTrials/Arduino-master/build/windows/work/lib/arduino-core.jar +REM set core_path=C:/temp/JavaTrials/Arduino-master/arduino-core/arduino-core.jar +set core_path=D:/Program Files (x86)/Arduino/lib/arduino-core.jar +REM set lib_path=C:/temp/JavaTrials/Arduino-master/build/windows/work/lib/commons-codec-1.7.jar +REM set lib_path=C:/temp/JavaTrials/Arduino-master/app/lib/commons-codec-1.7.jar +REM set lib_path=C:/temp/JavaTrials/Arduino-master/arduino-core/lib/commons-codec-1.7.jar +set lib_path=D:/Program Files (x86)/Arduino/lib/commons-codec-1.7.jar + +echo pde_path: %pde_path% +echo core_path: %core_path% +echo lib_path: %lib_path% + +mkdir bin + +ECHO on +javac -target 1.8 -source 1.8 -cp "%pde_path%;%core_path%;%lib_path%" -d bin src/ESP8266LittleFS.java +ECHO off + +mkdir tools +mkdir tools\ESP8266LittleFS +mkdir tools\ESP8266LittleFS\tool +erase tools\ESP8266LittleFS\tool\esp8266littlefs.jar + +cd bin + +jar cfveM ..\tools\ESP8266LittleFS\tool\esp8266littlefs.jar -C com\esp8266\mklittlefs ESP8266LittleFS.class ESP8266LittleFS$1.class ESP8266LittleFS$2.class + +cd .. + +exit /B + +REM popd + +REM dist=$PWD/dist +REM rev=$(git describe --tags) +REM mkdir -p $dist +REM pushd $INSTALLDIR/tools +REM rm -f $dist/*.zip +REM zip -r $dist/ESP8266LittleFS-$rev.zip ESP8266LittleFS/ +REM popd diff --git a/src/ESP8266LittleFS.java b/src/ESP8266LittleFS.java index 70a2001..2bd6302 100644 --- a/src/ESP8266LittleFS.java +++ b/src/ESP8266LittleFS.java @@ -6,6 +6,7 @@ Original copyright (c) 2015 Hristo Gochkov (ficeto at ficeto dot com) Modified from SPIFFS to LittleFS by Earle F. Philhower, III + Modified for OTA password by Ladi Kehl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -320,7 +321,17 @@ private void createAndUpload(){ if(isNetwork){ System.out.println("[LittleFS] IP : "+serialPort); System.out.println(); - sysExec(new String[]{pythonCmd, espota.getAbsolutePath(), "-i", serialPort, "-s", "-f", imagePath}); + + // ask for a password + String passCode = JOptionPane.showInputDialog(editor, "Please enter password:\n(leave empty if none required!)","ESP8266LittleFS OTA Update", JOptionPane.QUESTION_MESSAGE); + if(passCode != null) { + if(passCode.isEmpty()) { + sysExec(new String[]{pythonCmd, espota.getAbsolutePath(), "-i", serialPort, "-s", "-f", imagePath}); + } else { + sysExec(new String[]{pythonCmd, espota.getAbsolutePath(), "-i", serialPort, "-s", "-f", imagePath, "-a", passCode}); + } + } + } else { System.out.println("[LittleFS] address : "+uploadAddress); System.out.println("[LittleFS] reset : "+resetMethod);