added power button to html

made spiffs optional (disabled by default)
This commit is contained in:
cschwinne 2017-05-08 21:00:06 +02:00
parent bbc9a890a6
commit 134ec052fc
6 changed files with 53 additions and 16 deletions

View File

@ -1,13 +1,12 @@
WLED is a basic, fast and (relatively) (ok, VERY relatively) secure implementation of a ESP8266 webserver to control Neopixel (WS2812B) leds
Uses ESP arduino version 2.3.0 (latest as of April 2017).
Uses ESP arduino version 2.3.0 (latest as of May 2017).
Contents in the /data directory may be uploaded to SPIFFS.
Features: (V0.3pd)
- RGB and brightness sliders
- Settings page - configuration over network
- Access Point and station mode - automatic failsafe AP
- Edit page. Change html and other files via OTA.
- WS2812FX library integrated for nearly 50 special effects!
- Nightlight function (gradually dims down)
- Notifier function (multiple ESPs sync color via UDP broadcast)
@ -17,9 +16,10 @@ Features: (V0.3pd)
- Alexa smart home device server
- (unstable) NTP and experimental analog clock function
- better client HTML page (not yet implemented)
- Edit page. Change html and other files via OTA. (needs to be enabled in source)
Compile settings:
Board: WeMos D1 mini (untested with other HW, should work if it has 4MB flash)
Board: WeMos D1 mini (untested with other HW, should work though)
CPU frequency: 80 MHz
Flash size : 4MB (1MB SPIFFS)
Upload speed: 115200
@ -31,22 +31,17 @@ Quick start guide:
Just flash a basic HTTP OTA updater sketch and upload the bin!
1. Make sure your ESP module has a min. 4MB SPI flash module. (currently working on supporting 1MB modules)
1. Make sure your ESP module has a min. 4MB SPI flash module. (SHOULD now support 1MB modules, untested)
Connect a WS2812B RGB led strip to GPIO2. Optionally connect a NO-pushbutton to GPIO0 (internal pull-up) and ground.
2. Follow a guide to setup your Arduino client (I am using version 1.8.1) with the ESP8266 libraries.
For current compiles I use version 2.3.0.
3. You will also need the ESP8266 SPIFFS sketch data uploader. (currently working on making this step unnecessary)
-> In the newest commit this step is not essential (HTML included in sketch), but recommended, since otherwise you have to upload the pictures manually to /edit SPIFFS
-> The software will always use the HTML files in SPIFFS. If they are not existing, it will fallback to the sketch embedded HTML files.
4. In file "wled00.ino", change the LED count to the amount you connected. Proceed to flash the sketch and the SPIFFS data.
You should also change the access point and OTA update passphrases for added security (you can change them later, this is just the "factory default").
3. In file "wled00.ino", you should change the access point and OTA update passphrases for added security (you can change them later, this is just the "factory default"). Flash the sketch.
5. Connect to automatically started WiFi access point "WLED-AP" using default passwort "wled1234". Go to the IP "192.168.4.1".
6. Click on the wrench icon to edit settings like connecting the module to your home WiFi.
6. Click on the cog icon to edit settings like connecting the module to your home WiFi.
7. Have fun with the software!
@ -87,7 +82,7 @@ Method 2: The software has an integrated OTA software update capability.
First you have to enable it by typing in the correct OTA passphrase (default: "wledota") in the settings menu.
Remove the tick in the checkbox "OTA locked". Then save settings and reboot the ESP.
Now you can go to "<moduleip>/update" to update binary firmware.
To edit flash content (images and HTML), go to "<moduleip>/edit".
To edit flash content (images and HTML), go to "<moduleip>/edit". (only if USEFS was uncommented in source)
After you are done, it is recommended to lock the OTA function again.
To do so, tick the checkbox again (you can change the passphrase by typing in a new one now). Reboot.
If you try to access the update page now, you should see the message "OTA lock active".

View File

@ -114,6 +114,25 @@
} else {
nsb.style.fill="black";
}
if (Ctrl_form.SA.value > 0)
{
tgb.style.fill="green";
} else {
tgb.style.fill="black";
}
}
function ToggleT()
{
if (Ctrl_form.SA.value > 0)
{
strA = "&T=0";
Ctrl_form.SA.value = 0;
} else
{
strA = "&T=2";
}
UpdateVals();
GetArduinoIO();
}
function ToggleFX()
{
@ -397,7 +416,7 @@
transform: translate(-50%, -50%);
}
svg {
width: 15vw;
width: 12vw;
height: 10vmin;
}
input[type=range] {
@ -474,6 +493,9 @@
<path d="M16 32c8.837 0 16-7.163 16-16s-7.163-16-16-16-16 7.163-16 16 7.163 16 16 16zM16 3c7.18 0 13 5.82 13 13s-5.82 13-13 13-13-5.82-13-13 5.82-13 13-13z"></path>
<path d="M20.914 9.914l-2.829-2.829-8.914 8.914 8.914 8.914 2.828-2.828-6.086-6.086z"></path>
</symbol>
<symbol id="icon-switch" viewBox="0 0 32 32">
<path d="M20 4.581v4.249c1.131 0.494 2.172 1.2 3.071 2.099 1.889 1.889 2.929 4.4 2.929 7.071s-1.040 5.182-2.929 7.071c-1.889 1.889-4.4 2.929-7.071 2.929s-5.182-1.040-7.071-2.929c-1.889-1.889-2.929-4.4-2.929-7.071s1.040-5.182 2.929-7.071c0.899-0.899 1.94-1.606 3.071-2.099v-4.249c-5.783 1.721-10 7.077-10 13.419 0 7.732 6.268 14 14 14s14-6.268 14-14c0-6.342-4.217-11.698-10-13.419zM14 0h4v16h-4z"></path>
</symbol>
<symbol id="icon-equalizer" viewBox="0 0 32 32">
<path d="M14 4v-0.5c0-0.825-0.675-1.5-1.5-1.5h-5c-0.825 0-1.5 0.675-1.5 1.5v0.5h-6v4h6v0.5c0 0.825 0.675 1.5 1.5 1.5h5c0.825 0 1.5-0.675 1.5-1.5v-0.5h18v-4h-18zM8 8v-4h4v4h-4zM26 13.5c0-0.825-0.675-1.5-1.5-1.5h-5c-0.825 0-1.5 0.675-1.5 1.5v0.5h-18v4h18v0.5c0 0.825 0.675 1.5 1.5 1.5h5c0.825 0 1.5-0.675 1.5-1.5v-0.5h6v-4h-6v-0.5zM20 18v-4h4v4h-4zM14 23.5c0-0.825-0.675-1.5-1.5-1.5h-5c-0.825 0-1.5 0.675-1.5 1.5v0.5h-6v4h6v0.5c0 0.825 0.675 1.5 1.5 1.5h5c0.825 0 1.5-0.675 1.5-1.5v-0.5h18v-4h-18v-0.5zM8 28v-4h4v4h-4z"></path>
</symbol>
@ -495,6 +517,7 @@
</defs>
</svg>
<div id="tbB" class="tool_box">
<svg id="tgb" onclick="ToggleT()"><use xlink:href="#icon-switch"></use></svg>
<svg id="mdb" onclick="ToggleHSB()"><use xlink:href="#icon-equalizer"></use></svg>
<svg id="fxb" onclick="ToggleFX()"><use xlink:href="#icon-star-full"></use></svg>
<svg id="nlb" onclick="ToggleNl()"><use xlink:href="#icon-clock"></use></svg>

File diff suppressed because one or more lines are too long

View File

@ -22,10 +22,13 @@
#include "CallbackFunction.h"
//version in format yymmddb (b = daily build)
#define VERSION 1705081
#define VERSION 1705082
//to toggle usb serial debug (un)comment following line
#define DEBUG
//#define DEBUG
//spiffs FS only useful for debug
//#define USEFS
#ifdef DEBUG
#define DEBUG_PRINT(x) Serial.print (x)

View File

@ -1,6 +1,7 @@
/*
* Utility for SPIFFS filesystem
*/
#ifdef USEFS
String formatBytes(size_t bytes){
if (bytes < 1024){
@ -122,3 +123,11 @@ void handleFileCreate(){
server.send(200, "text/plain", "");
path = String();
}
#else
bool handleFileRead(String path){return false;}
void handleFileList(){}
void handleFileCreate(){}
void handleFileDelete(){}
void handleFileUpload(){}
#endif

View File

@ -6,6 +6,7 @@ void wledInit()
{
Serial.begin(115200);
#ifdef USEFS
SPIFFS.begin();
{
Dir dir = SPIFFS.openDir("/");
@ -18,6 +19,8 @@ void wledInit()
}
DEBUG_PRINTF("\n");
}
#endif
DEBUG_PRINTLN("Init EEPROM");
EEPROM.begin(1024);
loadSettingsFromEEPROM();