Re-added support for 512K flash ESPs

This commit is contained in:
cschwinne 2018-09-17 11:15:08 +02:00
parent 4715180a32
commit bb7f673ff9
9 changed files with 181 additions and 213 deletions

View File

@ -64,10 +64,11 @@ var displayElement=pr.getElementsByClassName("rangeValues")[0];displayElement.in
)====="; )=====";
#else #else
const char PAGE_indexM[] PROGMEM = R"=====( const char PAGE_indexM[] PROGMEM = R"=====(
The Mobile UI is not supported due to limited flash storage. Please go to IP/settings/ui and change the UI mode to "Classic". Mobile UI is unsupported (limited storage). Go to /settings/ui and change UI mode to "Classic".
)====="; )=====";
#endif #endif
/* /*
* Classic UI Index html * Classic UI Index html
*/ */

View File

@ -1,10 +1,14 @@
/* /*
* Settings html * Settings html
*/ */
//common CSS of settings pages
const char PAGE_settingsCss[] PROGMEM = R"=====( const char PAGE_settingsCss[] PROGMEM = R"=====(
body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%;margin:0;background-attachment:fixed}hr{border-color:var(--dCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}.helpB{text-align:left;position:absolute;width:60px}input{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.5ch solid var(--bCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}input[type=number]{width:3em}select{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:0.5ch solid var(--bCol);filter:drop-shadow( -5px -5px 5px var(--sCol) );}</style> body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%;margin:0;background-attachment:fixed}hr{border-color:var(--dCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}.helpB{text-align:left;position:absolute;width:60px}input{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.5ch solid var(--bCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}input[type=number]{width:3em}select{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:0.5ch solid var(--bCol);filter:drop-shadow( -5px -5px 5px var(--sCol) );}</style>
)====="; )=====";
//settings menu
const char PAGE_settings0[] PROGMEM = R"=====( const char PAGE_settings0[] PROGMEM = R"=====(
<!DOCTYPE html> <!DOCTYPE html>
<html><head><title>WLED Settings</title> <html><head><title>WLED Settings</title>
@ -26,11 +30,14 @@ body{text-align:center;background:var(--cCol);height:100%;margin:0;background-at
</html> </html>
)====="; )=====";
//wifi settings
const char PAGE_settings_wifi0[] PROGMEM = R"=====( const char PAGE_settings_wifi0[] PROGMEM = R"=====(
<!DOCTYPE html> <!DOCTYPE html>
<html><head> <html><head>
<title>WiFi Settings</title><script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#wifi-settings");}function B(){window.history.back();}function GetV(){var d = document; <title>WiFi Settings</title><script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#wifi-settings");}function B(){window.history.back();}function GetV(){var d = document;
)====="; )=====";
const char PAGE_settings_wifi1[] PROGMEM = R"=====( const char PAGE_settings_wifi1[] PROGMEM = R"=====(
</head> </head>
<body onload="GetV()"> <body onload="GetV()">
@ -72,11 +79,14 @@ AP IP: <span class="sip"> Not active </span><hr>
</html> </html>
)====="; )=====";
//LED settings
const char PAGE_settings_leds0[] PROGMEM = R"=====( const char PAGE_settings_leds0[] PROGMEM = R"=====(
<!DOCTYPE html> <!DOCTYPE html>
<html><head> <html><head>
<title>LED Settings</title><script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#led-settings");}function B(){window.history.back();}function GetV(){var d = document; <title>LED Settings</title><script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#led-settings");}function B(){window.history.back();}function GetV(){var d = document;
)====="; )=====";
const char PAGE_settings_leds1[] PROGMEM = R"=====( const char PAGE_settings_leds1[] PROGMEM = R"=====(
</head> </head>
<body onload="GetV()"> <body onload="GetV()">
@ -138,12 +148,15 @@ Skip first LED: <input type="checkbox" name="SL"><hr>
</html> </html>
)====="; )=====";
//User Interface settings
const char PAGE_settings_ui0[] PROGMEM = R"=====( const char PAGE_settings_ui0[] PROGMEM = R"=====(
<!DOCTYPE html> <!DOCTYPE html>
<html><head> <html><head>
<title>UI Settings</title><script> <title>UI Settings</title><script>
function gId(s){return document.getElementById(s);}function S(){GetV();Ct();}function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#user-interface-settings");}function B(){window.history.back();}function Ct(){if (gId("co").selected){gId("cth").style.display="block";}else{gId("cth").style.display="none";}}function GetV(){var d = document; function gId(s){return document.getElementById(s);}function S(){GetV();Ct();}function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#user-interface-settings");}function B(){window.history.back();}function Ct(){if (gId("co").selected){gId("cth").style.display="block";}else{gId("cth").style.display="none";}}function GetV(){var d = document;
)====="; )=====";
const char PAGE_settings_ui1[] PROGMEM = R"=====( const char PAGE_settings_ui1[] PROGMEM = R"=====(
</head> </head>
<body onload="S()"> <body onload="S()">
@ -195,11 +208,14 @@ Make sure the font you use is installed on your system!<br>
</html> </html>
)====="; )=====";
//sync settings
const char PAGE_settings_sync0[] PROGMEM = R"=====( const char PAGE_settings_sync0[] PROGMEM = R"=====(
<!DOCTYPE html> <!DOCTYPE html>
<html><head><title>Sync Settings</title> <html><head><title>Sync Settings</title>
<script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#sync-settings");}function B(){window.open("/settings","_self");}function GetV(){var d = document; <script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#sync-settings");}function B(){window.open("/settings","_self");}function GetV(){var d = document;
)====="; )=====";
const char PAGE_settings_sync1[] PROGMEM = R"=====( const char PAGE_settings_sync1[] PROGMEM = R"=====(
</head> </head>
<body onload="GetV()"> <body onload="GetV()">
@ -252,11 +268,14 @@ Hue status: <span class="hms"> Internal ESP Error! </span><hr>
</html> </html>
)====="; )=====";
//time and macro settings
const char PAGE_settings_time0[] PROGMEM = R"=====( const char PAGE_settings_time0[] PROGMEM = R"=====(
<!DOCTYPE html> <!DOCTYPE html>
<html><head><title>Time Settings</title> <html><head><title>Time Settings</title>
<script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#time-settings");}function B(){window.open("/settings","_self");}function S(){GetV();Cs();}function gId(s){return document.getElementById(s);}function Cs(){gId("cac").style.display="none";gId("coc").style.display="block";gId("ccc").style.display="none";if (gId("ca").selected){gId("cac").style.display="block";}if (gId("cc").selected){gId("coc").style.display="none";gId("ccc").style.display="block";}if (gId("cn").selected){gId("coc").style.display="none";}}function GetV(){var d = document; <script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#time-settings");}function B(){window.open("/settings","_self");}function S(){GetV();Cs();}function gId(s){return document.getElementById(s);}function Cs(){gId("cac").style.display="none";gId("coc").style.display="block";gId("ccc").style.display="none";if (gId("ca").selected){gId("cac").style.display="block";}if (gId("cc").selected){gId("coc").style.display="none";gId("ccc").style.display="block";}if (gId("cn").selected){gId("coc").style.display="none";}}function GetV(){var d = document;
)====="; )=====";
const char PAGE_settings_time1[] PROGMEM = R"=====( const char PAGE_settings_time1[] PROGMEM = R"=====(
</head> </head>
<body onload="S()"> <body onload="S()">
@ -338,12 +357,15 @@ Timed-Light-Over Macro: <input name="MN" type="number" min="0" max="16" required
</html> </html>
)====="; )=====";
//security settings and about
const char PAGE_settings_sec0[] PROGMEM = R"=====( const char PAGE_settings_sec0[] PROGMEM = R"=====(
<!DOCTYPE html> <!DOCTYPE html>
<html><head> <html><head>
<title>Misc Settings</title> <title>Misc Settings</title>
<script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#security-settings");}function B(){window.open("/settings","_self");}function U(){window.open("/update","_self");}function GetV(){var d = document; <script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#security-settings");}function B(){window.open("/settings","_self");}function U(){window.open("/update","_self");}function GetV(){var d = document;
)====="; )=====";
const char PAGE_settings_sec1[] PROGMEM = R"=====( const char PAGE_settings_sec1[] PROGMEM = R"=====(
</head> </head>
<body onload="GetV()"> <body onload="GetV()">

View File

@ -1,27 +1,36 @@
//USER HTML /*
* Various pages
*/
//USER HTML HERE (/u subpage)
const char PAGE_usermod[] PROGMEM = R"=====( const char PAGE_usermod[] PROGMEM = R"=====(
<html><body>There is no usermod installed or it doesn't specify a custom web page.</body></html> <html><body>There is no usermod installed or it doesn't specify a custom web page.</body></html>
)====="; )=====";
/*
* Various
*/ //server message
const char PAGE_msg0[] PROGMEM = R"=====( const char PAGE_msg0[] PROGMEM = R"=====(
<!DOCTYPE html> <!DOCTYPE html>
<html><head> <html><head>
<title>WLED Message</title> <title>WLED Message</title>
<script>function B(){window.history.back()};function RS(){window.location = "/settings";}function RP(){top.location.href="/";}</script> <script>function B(){window.history.back()};function RS(){window.location = "/settings";}function RP(){top.location.href="/";}</script>
)====="; )=====";
const char PAGE_msg1[] PROGMEM = R"=====( const char PAGE_msg1[] PROGMEM = R"=====(
button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%;margin:0;background-attachment:fixed}</style> button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%;margin:0;background-attachment:fixed}</style>
</head> </head>
<body> <body>
)====="; )=====";
//new user welcome page
#ifndef WLED_FLASH_512K_MODE
const char PAGE_welcome0[] PROGMEM = R"=====( const char PAGE_welcome0[] PROGMEM = R"=====(
<!DOCTYPE html> <!DOCTYPE html>
<html><head> <html><head>
<title>WLED Welcome!</title> <title>WLED Welcome!</title>
)====="; )=====";
const char PAGE_welcome1[] PROGMEM = R"=====( const char PAGE_welcome1[] PROGMEM = R"=====(
body{font-family:var(--cFn),sans-serif;text-align:center;background:linear-gradient(var(--bCol),black);height:100%;margin:0;background-repeat:no-repeat;background-attachment: fixed;color: var(--tCol);}svg {fill: var(--dCol);} body{font-family:var(--cFn),sans-serif;text-align:center;background:linear-gradient(var(--bCol),black);height:100%;margin:0;background-repeat:no-repeat;background-attachment: fixed;color: var(--tCol);}svg {fill: var(--dCol);}
</style></head> </style></head>
@ -41,6 +50,11 @@ Connect the module to your local WiFi <a href="/settings/wifi">here</a>!<br><br>
<i>Just trying this out in AP mode?</i> <a href="/sliders">Here are the controls.</a><br> <i>Just trying this out in AP mode?</i> <a href="/sliders">Here are the controls.</a><br>
</body></html> </body></html>
)====="; )=====";
#else
const char PAGE_welcome0[] PROGMEM = "";
const char PAGE_welcome1[] PROGMEM = "";
#endif
/* /*
* SPIFFS editor html * SPIFFS editor html
@ -54,6 +68,8 @@ eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a
#else #else
const char PAGE_edit[] PROGMEM = R"=====(SPIFFS disabled)====="; const char PAGE_edit[] PROGMEM = R"=====(SPIFFS disabled)=====";
#endif #endif
/* /*
* favicon * favicon
*/ */

View File

@ -1,4 +1,9 @@
/*
* Color palettes for FastLED effects (65-73).
*/
// From ColorWavesWithPalettes by Mark Kriegsman: https://gist.github.com/kriegsman/8281905786e8b2632aeb // From ColorWavesWithPalettes by Mark Kriegsman: https://gist.github.com/kriegsman/8281905786e8b2632aeb
// Unfortunaltely, these are stored in RAM!
// Gradient palette "ib_jul01_gp", originally from // Gradient palette "ib_jul01_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/ing/xmas/tn/ib_jul01.png.index.html // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ing/xmas/tn/ib_jul01.png.index.html

View File

@ -8,9 +8,8 @@
*/ */
//ESP8266-01 got too little storage space to work with all features of WLED. To use it, you must use ESP8266 Arduino Core v2.3.0 and the setting 512K(64K SPIFFS). //ESP8266-01 got too little storage space to work with all features of WLED. To use it, you must use ESP8266 Arduino Core v2.3.0 and the setting 512K(64K SPIFFS).
//Uncomment the following line to disable some features (currently Mobile UI) to compile for ESP8266-01 //Uncomment the following line to disable some features (currently Mobile UI, welcome page and single digit + cronixie overlays) to compile for ESP8266-01
//#define WLED_FLASH_512K_MODE #define WLED_FLASH_512K_MODE
//NOT SUPPORTED IN CURRENT VERSION
//library inclusions //library inclusions
@ -44,7 +43,7 @@
//version code in format yymmddb (b = daily build) //version code in format yymmddb (b = daily build)
#define VERSION 1809151 #define VERSION 1809162
char versionString[] = "0.8.0-a"; char versionString[] = "0.8.0-a";
@ -58,7 +57,7 @@ char otaPass[33] = "wledota";
//to toggle usb serial debug (un)comment following line(s) //to toggle usb serial debug (un)comment following line(s)
#define DEBUG //#define DEBUG
//Hardware CONFIG (only changeble HERE, not at runtime) //Hardware CONFIG (only changeble HERE, not at runtime)
@ -157,7 +156,7 @@ bool arlsDisableGammaCorrection = true; //activate if gamma correction is
bool arlsForceMaxBri = false; //enable to force max brightness if source has very dark colors that would be black bool arlsForceMaxBri = false; //enable to force max brightness if source has very dark colors that would be black
bool e131Enabled = true; //settings for E1.31 (sACN) protocol bool e131Enabled = true; //settings for E1.31 (sACN) protocol
byte e131Universe = 1; uint16_t e131Universe = 1;
bool e131Multicast = false; bool e131Multicast = false;
bool huePollingEnabled = false; //poll hue bridge for light state bool huePollingEnabled = false; //poll hue bridge for light state

View File

@ -13,6 +13,8 @@ void _setRandomColor(bool _sec,bool fromButton=false)
if (fromButton) colorUpdated(2); if (fromButton) colorUpdated(2);
} }
//called upon POST settings form submit
void handleSettingsSet(byte subPage) void handleSettingsSet(byte subPage)
{ {
//0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec //0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec
@ -21,59 +23,42 @@ void handleSettingsSet(byte subPage)
//WIFI SETTINGS //WIFI SETTINGS
if (subPage == 1) if (subPage == 1)
{ {
if (server.hasArg("CS")) strcpy(clientSSID,server.arg("CS").c_str()); strcpy(clientSSID,server.arg("CS").c_str());
if (server.hasArg("CP")) if (server.arg("CP").charAt(0) != '*') strcpy(clientPass, server.arg("CP").c_str());
{
if (!server.arg("CP").indexOf('*') == 0) strcpy(cmDNS, server.arg("CM").c_str());
{
strcpy(clientPass,server.arg("CP").c_str()); int t = server.arg("AT").toInt(); if (t > 9 && t <= 255) apWaitTimeSecs = t;
} strcpy(apSSID, server.arg("AS").c_str());
}
if (server.hasArg("CM")) strcpy(cmDNS,server.arg("CM").c_str());
if (server.hasArg("AT"))
{
int i = server.arg("AT").toInt();
if (i >= 0 && i <= 255) apWaitTimeSecs = i;
}
if (server.hasArg("AS")) strcpy(apSSID,server.arg("AS").c_str());
apHide = server.hasArg("AH"); apHide = server.hasArg("AH");
if (server.hasArg("AP")) if (server.arg("AP").charAt(0) != '*') strcpy(apPass, server.arg("AP").c_str());
{ t = server.arg("AC").toInt(); if (t > 0 && t < 14) apChannel = t;
if (server.arg("AP").charAt(0) != '*') strcpy(apPass,server.arg("AP").c_str());
} char k[3]; k[2] = 0;
if (server.hasArg("AC"))
{
int chan = server.arg("AC").toInt();
if (chan > 0 && chan < 14) apChannel = chan;
}
char k[3]; k[2] = 0; int j = 0;
for (int i = 0; i<4; i++) for (int i = 0; i<4; i++)
{ {
k[1] = i+48; k[1] = i+48;//ascii 0,1,2,3
k[0] = 'I'; //static IP k[0] = 'I'; //static IP
if (server.hasArg(k)) j = server.arg(k).toInt(); staticIP[i] = server.arg(k).toInt();
if (j >= 0 && j <= 255) staticIP[i] = j;
k[0] = 'G'; //gateway k[0] = 'G'; //gateway
if (server.hasArg(k)) j = server.arg(k).toInt(); staticGateway[i] = server.arg(k).toInt();
if (j >= 0 && j <= 255) staticGateway[i] = j;
k[0] = 'S'; //subnet k[0] = 'S'; //subnet
if (server.hasArg(k)) j = server.arg(k).toInt(); staticSubnet[i] = server.arg(k).toInt();
if (j >= 0 && j <= 255) staticSubnet[i] = j;
} }
} }
//LED SETTINGS //LED SETTINGS
if (subPage == 2) if (subPage == 2)
{ {
if (server.hasArg("LC")) int t = server.arg("LC").toInt();
{ if (t > 0 && t <= 1200) ledCount = t;
int i = server.arg("LC").toInt(); //RMT eats up too much RAM
if (i > 0 && i <= 1200) ledCount = i; #ifdef ARDUINO_ARCH_ESP32
//RMT eats up too much RAM if (ledCount > 600) ledCount = 600;
#ifdef ARDUINO_ARCH_ESP32 #endif
if (ledCount > 600) ledCount = 600;
#endif
}
useRGBW = server.hasArg("EW"); useRGBW = server.hasArg("EW");
autoRGBtoRGBW = server.hasArg("AW"); autoRGBtoRGBW = server.hasArg("AW");
if (server.hasArg("IS")) //ignore settings and save current brightness, colors and fx as default if (server.hasArg("IS")) //ignore settings and save current brightness, colors and fx as default
@ -81,141 +66,75 @@ void handleSettingsSet(byte subPage)
colS[0] = col[0]; colS[0] = col[0];
colS[1] = col[1]; colS[1] = col[1];
colS[2] = col[2]; colS[2] = col[2];
if (useRGBW) whiteS = white; colSecS[0] = colSec[0];
colSecS[1] = colSec[1];
colSecS[2] = colSec[2];
whiteS = white;
whiteSecS = whiteSec;
briS = bri; briS = bri;
effectDefault = effectCurrent; effectDefault = effectCurrent;
effectSpeedDefault = effectSpeed; effectSpeedDefault = effectSpeed;
effectIntensityDefault = effectIntensity; effectIntensityDefault = effectIntensity;
effectPaletteDefault = effectPalette; effectPaletteDefault = effectPalette;
} else { } else {
if (server.hasArg("CR")) colS[0] = server.arg("CR").toInt();
{ colS[1] = server.arg("CG").toInt();
int i = server.arg("CR").toInt(); colS[2] = server.arg("CB").toInt();
if (i >= 0 && i <= 255) colS[0] = i; colSecS[0] = server.arg("SR").toInt();
} colSecS[1] = server.arg("SG").toInt();
if (server.hasArg("CG")) colSecS[2] = server.arg("SB").toInt();
{ whiteS = server.arg("CW").toInt();
int i = server.arg("CG").toInt(); whiteSecS = server.arg("SW").toInt();
if (i >= 0 && i <= 255) colS[1] = i; briS = server.arg("CA").toInt();
} effectDefault = server.arg("FX").toInt();
if (server.hasArg("CB")) effectSpeedDefault = server.arg("SX").toInt();
{ effectIntensityDefault = server.arg("IX").toInt();
int i = server.arg("CB").toInt(); effectPaletteDefault = server.arg("FP").toInt();
if (i >= 0 && i <= 255) colS[2] = i;
}
if (server.hasArg("SR"))
{
int i = server.arg("SR").toInt();
if (i >= 0 && i <= 255) colSecS[0] = i;
}
if (server.hasArg("SG"))
{
int i = server.arg("SG").toInt();
if (i >= 0 && i <= 255) colSecS[1] = i;
}
if (server.hasArg("SB"))
{
int i = server.arg("SB").toInt();
if (i >= 0 && i <= 255) colSecS[2] = i;
}
if (server.hasArg("SW"))
{
int i = server.arg("SW").toInt();
if (i >= 0 && i <= 255) whiteSecS = i;
}
if (server.hasArg("CW"))
{
int i = server.arg("CW").toInt();
if (i >= 0 && i <= 255) whiteS = i;
}
if (server.hasArg("CA"))
{
int i = server.arg("CA").toInt();
if (i >= 0 && i <= 255) briS = i;
}
if (server.hasArg("FX"))
{
int i = server.arg("FX").toInt();
if (i >= 0 && i <= 255) effectDefault = i;
}
if (server.hasArg("SX"))
{
int i = server.arg("SX").toInt();
if (i >= 0 && i <= 255) effectSpeedDefault = i;
}
if (server.hasArg("IX"))
{
int i = server.arg("IX").toInt();
if (i >= 0 && i <= 255) effectIntensityDefault = i;
}
if (server.hasArg("FP"))
{
int i = server.arg("FP").toInt();
if (i >= 0 && i <= 255) effectPaletteDefault = i;
}
} }
saveCurrPresetCycConf = server.hasArg("PC"); saveCurrPresetCycConf = server.hasArg("PC");
turnOnAtBoot = server.hasArg("BO"); turnOnAtBoot = server.hasArg("BO");
if (server.hasArg("BP")) t = server.arg("BP").toInt();
{ if (t <= 25) bootPreset = t;
int i = server.arg("BP").toInt();
if (i >= 0 && i <= 25) bootPreset = i;
}
useGammaCorrectionBri = server.hasArg("GB"); useGammaCorrectionBri = server.hasArg("GB");
useGammaCorrectionRGB = server.hasArg("GC"); useGammaCorrectionRGB = server.hasArg("GC");
fadeTransition = server.hasArg("TF"); fadeTransition = server.hasArg("TF");
if (server.hasArg("TD")) t = server.arg("TD").toInt();
{ if (t > 0) transitionDelay = t;
int i = server.arg("TD").toInt();
if (i > 0){
transitionDelay = i;
}
}
strip.paletteFade = server.hasArg("PF"); strip.paletteFade = server.hasArg("PF");
enableSecTransition = server.hasArg("T2"); enableSecTransition = server.hasArg("T2");
if (server.hasArg("TB"))
{ nightlightTargetBri = server.arg("TB").toInt();
nightlightTargetBri = server.arg("TB").toInt(); t = server.arg("TL").toInt();
} if (t > 0) nightlightDelayMins = t;
if (server.hasArg("TL"))
{
int i = server.arg("TL").toInt();
if (i > 0) nightlightDelayMins = i;
}
nightlightFade = server.hasArg("TW"); nightlightFade = server.hasArg("TW");
reverseMode = server.hasArg("RV");
if (server.hasArg("PB")) t = server.arg("PB").toInt();
{ if (t >= 0 && t < 4) strip.paletteBlend = t;
int i = server.arg("PB").toInt();
if (i >= 0){
strip.paletteBlend = i;
}
}
initLedsLast = server.hasArg("EI"); initLedsLast = server.hasArg("EI");
reverseMode = server.hasArg("RV");
strip.setReverseMode(reverseMode); strip.setReverseMode(reverseMode);
skipFirstLed = server.hasArg("SL"); skipFirstLed = server.hasArg("SL");
if (server.hasArg("BF")) t = server.arg("BF").toInt();
{ if (t > 0) briMultiplier = t;
int i = server.arg("BF").toInt();
if (i > 0) briMultiplier = i;
}
} }
//UI //UI
if (subPage == 3) if (subPage == 3)
{ {
if (server.hasArg("UI")) uiConfiguration = server.arg("UI").toInt(); int t = server.arg("UI").toInt();
if (server.hasArg("DS")) strcpy(serverDescription,server.arg("DS").c_str()); if (t >= 0 && t < 3) uiConfiguration = t;
strcpy(serverDescription, server.arg("DS").c_str());
useHSBDefault = server.hasArg("MD"); useHSBDefault = server.hasArg("MD");
useHSB = useHSBDefault; useHSB = useHSBDefault;
if (server.hasArg("TH")) currentTheme = server.arg("TH").toInt(); currentTheme = server.arg("TH").toInt();
char k[3]; k[0]='C'; k[2]=0; char k[3]; k[0]='C'; k[2]=0;
for(int i=0;i<6;i++) for(int i=0;i<6;i++)
{ {
k[1] = i+48; k[1] = i+48;
if (server.hasArg(k)) strcpy(cssCol[i],server.arg(k).c_str()); strcpy(cssCol[i],server.arg(k).c_str());
} }
if (server.hasArg("CF")) strcpy(cssFont,server.arg("CF").c_str()); strcpy(cssFont,server.arg("CF").c_str());
buildCssColorString(); buildCssColorString();
} }
@ -223,10 +142,8 @@ void handleSettingsSet(byte subPage)
if (subPage == 4) if (subPage == 4)
{ {
buttonEnabled = server.hasArg("BT"); buttonEnabled = server.hasArg("BT");
if (server.hasArg("UP")) int t = server.arg("UP").toInt();
{ if (t > 0) udpPort = t;
udpPort = server.arg("UP").toInt();
}
receiveNotificationBrightness = server.hasArg("RB"); receiveNotificationBrightness = server.hasArg("RB");
receiveNotificationColor = server.hasArg("RC"); receiveNotificationColor = server.hasArg("RC");
receiveNotificationEffects = server.hasArg("RX"); receiveNotificationEffects = server.hasArg("RX");
@ -235,45 +152,36 @@ void handleSettingsSet(byte subPage)
notifyDirect = notifyDirectDefault; notifyDirect = notifyDirectDefault;
notifyButton = server.hasArg("SB"); notifyButton = server.hasArg("SB");
notifyTwice = server.hasArg("S2"); notifyTwice = server.hasArg("S2");
receiveDirect = server.hasArg("RD"); receiveDirect = server.hasArg("RD");
if (server.hasArg("EU")) t = server.arg("EU").toInt();
{ if (t > 0 && t <= 63999) e131Universe = t;
int i = server.arg("EU").toInt(); t = server.arg("ET").toInt();
if (i > 0 && i <= 63999) realtimeTimeoutMs = i; if (t > 99 && t <= 65000) realtimeTimeoutMs = t;
}
if (server.hasArg("ET"))
{
int i = server.arg("ET").toInt();
if (i > 99 && i <= 65000) realtimeTimeoutMs = i;
}
arlsForceMaxBri = server.hasArg("FB"); arlsForceMaxBri = server.hasArg("FB");
arlsDisableGammaCorrection = server.hasArg("RG"); arlsDisableGammaCorrection = server.hasArg("RG");
if (server.hasArg("WO")) t = server.arg("WO").toInt();
{ if (t >= -255 && t <= 255) arlsOffset = t;
int i = server.arg("WO").toInt();
if (i >= -255 && i <= 255) arlsOffset = i;
}
enableRealtimeUI = server.hasArg("RU"); enableRealtimeUI = server.hasArg("RU");
alexaEnabled = server.hasArg("AL"); alexaEnabled = server.hasArg("AL");
if (server.hasArg("AI")) strcpy(alexaInvocationName,server.arg("AI").c_str()); strcpy(alexaInvocationName, server.arg("AI").c_str());
notifyAlexa = server.hasArg("SA"); notifyAlexa = server.hasArg("SA");
if (server.hasArg("BK") && !server.arg("BK").equals("Hidden")) {strcpy(blynkApiKey,server.arg("BK").c_str()); initBlynk(blynkApiKey);} if (server.hasArg("BK") && !server.arg("BK").equals("Hidden")) {strcpy(blynkApiKey,server.arg("BK").c_str()); initBlynk(blynkApiKey);}
notifyHue = server.hasArg("SH"); notifyHue = server.hasArg("SH");
for (int i=0;i<4;i++){ for (int i=0;i<4;i++){
String a = "H"+String(i); String a = "H"+String(i);
if (server.hasArg(a)) hueIP[i] = server.arg(a).toInt();
hueIP[i] = server.arg(a).toInt();
}
if (server.hasArg("HL"))
{
int i = server.arg("HL").toInt();
if (i > 0) huePollLightId = i;
}
if (server.hasArg("HI"))
{
int i = server.arg("HI").toInt();
if (i > 50) huePollIntervalMs = i;
} }
t = server.arg("HL").toInt();
if (t > 0) huePollLightId = t;
t = server.arg("HI").toInt();
if (t > 50) huePollIntervalMs = t;
hueApplyOnOff = server.hasArg("HO"); hueApplyOnOff = server.hasArg("HO");
hueApplyBri = server.hasArg("HB"); hueApplyBri = server.hasArg("HB");
hueApplyColor = server.hasArg("HC"); hueApplyColor = server.hasArg("HC");
@ -293,22 +201,22 @@ void handleSettingsSet(byte subPage)
{ {
ntpEnabled = server.hasArg("NT"); ntpEnabled = server.hasArg("NT");
useAMPM = !server.hasArg("CF"); useAMPM = !server.hasArg("CF");
if (server.hasArg("TZ")) currentTimezone = server.arg("TZ").toInt(); currentTimezone = server.arg("TZ").toInt();
if (server.hasArg("UO")) utcOffsetSecs = server.arg("UO").toInt(); utcOffsetSecs = server.arg("UO").toInt();
if (ntpEnabled && WiFi.status() == WL_CONNECTED && !ntpConnected) ntpConnected = ntpUdp.begin(ntpLocalPort); //start if not already connected if (ntpEnabled && WiFi.status() == WL_CONNECTED && !ntpConnected) ntpConnected = ntpUdp.begin(ntpLocalPort); //start if not already connected
if (server.hasArg("OL")){ if (server.hasArg("OL")){
overlayDefault = server.arg("OL").toInt(); overlayDefault = server.arg("OL").toInt();
overlayCurrent = overlayDefault; overlayCurrent = overlayDefault;
;
} }
if (server.hasArg("O1")) overlayMin = server.arg("O1").toInt();
if (server.hasArg("O2")) overlayMax = server.arg("O2").toInt(); overlayMin = server.arg("O1").toInt();
if (server.hasArg("OM")) analogClock12pixel = server.arg("OM").toInt(); overlayMax = server.arg("O2").toInt();
analogClock12pixel = server.arg("OM").toInt();
analogClock5MinuteMarks = server.hasArg("O5"); analogClock5MinuteMarks = server.hasArg("O5");
analogClockSecondsTrail = server.hasArg("OS"); analogClockSecondsTrail = server.hasArg("OS");
if (server.hasArg("CX")) strcpy(cronixieDisplay,server.arg("CX").c_str()); strcpy(cronixieDisplay,server.arg("CX").c_str());
bool cbOld = cronixieBacklight; bool cbOld = cronixieBacklight;
cronixieBacklight = server.hasArg("CB"); cronixieBacklight = server.hasArg("CB");
if (cbOld != cronixieBacklight && overlayCurrent == 4) if (cbOld != cronixieBacklight && overlayCurrent == 4)
@ -316,25 +224,25 @@ void handleSettingsSet(byte subPage)
strip.setCronixieBacklight(cronixieBacklight); overlayRefreshedTime = 0; strip.setCronixieBacklight(cronixieBacklight); overlayRefreshedTime = 0;
} }
countdownMode = server.hasArg("CE"); countdownMode = server.hasArg("CE");
if (server.hasArg("CY")) countdownYear = server.arg("CY").toInt(); countdownYear = server.arg("CY").toInt();
if (server.hasArg("CI")) countdownMonth = server.arg("CI").toInt(); countdownMonth = server.arg("CI").toInt();
if (server.hasArg("CD")) countdownDay = server.arg("CD").toInt(); countdownDay = server.arg("CD").toInt();
if (server.hasArg("CH")) countdownHour = server.arg("CH").toInt(); countdownHour = server.arg("CH").toInt();
if (server.hasArg("CM")) countdownMin = server.arg("CM").toInt(); countdownMin = server.arg("CM").toInt();
if (server.hasArg("CS")) countdownSec = server.arg("CS").toInt(); countdownSec = server.arg("CS").toInt();
for (int i=1;i<17;i++) for (int i=1;i<17;i++)
{ {
String a = "M"+String(i); String a = "M"+String(i);
if (server.hasArg(a)) saveMacro(i,server.arg(a),false); if (server.hasArg(a)) saveMacro(i,server.arg(a),false);
} }
if (server.hasArg("MB")) macroBoot = server.arg("MB").toInt(); macroBoot = server.arg("MB").toInt();
if (server.hasArg("A0")) macroAlexaOn = server.arg("A0").toInt(); macroAlexaOn = server.arg("A0").toInt();
if (server.hasArg("A1")) macroAlexaOff = server.arg("A1").toInt(); macroAlexaOff = server.arg("A1").toInt();
if (server.hasArg("MP")) macroButton = server.arg("MP").toInt(); macroButton = server.arg("MP").toInt();
if (server.hasArg("ML")) macroLongPress = server.arg("ML").toInt(); macroLongPress = server.arg("ML").toInt();
if (server.hasArg("MC")) macroCountdown = server.arg("MC").toInt(); macroCountdown = server.arg("MC").toInt();
if (server.hasArg("MN")) macroNl = server.arg("MN").toInt(); macroNl = server.arg("MN").toInt();
} }
//SECURITY //SECURITY
@ -375,9 +283,8 @@ void handleSettingsSet(byte subPage)
bool handleSet(String req) bool handleSet(String req)
{ {
bool effectUpdated = false; bool effectUpdated = false;
if (!(req.indexOf("win") >= 0)) { if (!(req.indexOf("win") >= 0)) return false;
return false;
}
int pos = 0; int pos = 0;
DEBUG_PRINT("API req: "); DEBUG_PRINT("API req: ");
DEBUG_PRINTLN(req); DEBUG_PRINTLN(req);

View File

@ -118,7 +118,7 @@ void wledInit()
server.on("/settings/wifi", HTTP_POST, [](){ server.on("/settings/wifi", HTTP_POST, [](){
if (!(wifiLock && otaLock)) handleSettingsSet(1); if (!(wifiLock && otaLock)) handleSettingsSet(1);
serveMessage(200,"WiFi settings saved.","Rebooting now... (takes ~20 seconds, wait for auto-redirect)",139); serveMessage(200,"WiFi settings saved.","Rebooting now...",255);
reset(); reset();
}); });
@ -488,6 +488,10 @@ void serveSettings(byte subPage)
//0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec 255: welcomepage //0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec 255: welcomepage
if (!realtimeActive || enableRealtimeUI) //do not serve while receiving realtime if (!realtimeActive || enableRealtimeUI) //do not serve while receiving realtime
{ {
#ifdef WLED_FLASH_512K_MODE //disable welcome page if not enough storage
if (subPage == 255) {serveIndex(); return;}
#endif
int pl0, pl1; int pl0, pl1;
switch (subPage) switch (subPage)
{ {

View File

@ -16,6 +16,7 @@ void initCronixie()
} }
} }
void _nixieDisplay(int num[], uint16_t dur[], uint16_t pausedur[], byte cnt) void _nixieDisplay(int num[], uint16_t dur[], uint16_t pausedur[], byte cnt)
{ {
strip.setRange(overlayMin, overlayMax, 0); strip.setRange(overlayMin, overlayMax, 0);
@ -116,6 +117,7 @@ void _nixieNumber(int number, int dur)
} }
} }
void handleOverlays() void handleOverlays()
{ {
if (millis() - overlayRefreshedTime > overlayRefreshMs) if (millis() - overlayRefreshedTime > overlayRefreshMs)
@ -181,6 +183,10 @@ void _overlayAnalogClock()
void _overlayNixieClock() void _overlayNixieClock()
{ {
#ifdef WLED_FLASH_512K_MODE
if (countdownMode) checkCountdown();
#else
if (countdownMode) if (countdownMode)
{ {
_overlayNixieCountdown(); return; _overlayNixieCountdown(); return;
@ -265,6 +271,7 @@ void _overlayNixieClock()
{ {
_nixieDisplay(overlayArr, overlayDur, overlayPauseDur, 6); _nixieDisplay(overlayArr, overlayDur, overlayPauseDur, 6);
} }
#endif
} }
void _overlayAnalogCountdown() void _overlayAnalogCountdown()
@ -312,6 +319,7 @@ void _overlayAnalogCountdown()
overlayRefreshMs = 998; overlayRefreshMs = 998;
} }
void _overlayNixieCountdown() void _overlayNixieCountdown()
{ {
if (now() >= countdownTime) if (now() >= countdownTime)

View File

@ -19,6 +19,7 @@ byte getSameCodeLength(char code, int index, char const cronixieDisplay[])
void setCronixie() void setCronixie()
{ {
#ifndef WLED_FLASH_512K_MODE
/* /*
* digit purpose index * digit purpose index
* 0-9 | 0-9 (incl. random) * 0-9 | 0-9 (incl. random)
@ -139,11 +140,14 @@ void setCronixie()
DEBUG_PRINTLN((int)dP[5]); DEBUG_PRINTLN((int)dP[5]);
_overlayCronixie(); //refresh _overlayCronixie(); //refresh
#endif
} }
void _overlayCronixie() void _overlayCronixie()
{ {
if (countdownMode) checkCountdown(); if (countdownMode) checkCountdown();
#ifndef WLED_FLASH_512K_MODE
byte h = hour(local); byte h = hour(local);
byte h0 = h; byte h0 = h;
byte m = minute(local); byte m = minute(local);
@ -208,4 +212,6 @@ void _overlayCronixie()
} }
strip.setCronixieDigits(_digitOut); strip.setCronixieDigits(_digitOut);
//strip.trigger(); //this has a drawback, no effects slower than RefreshMs. advantage: Quick update, not dependant on effect time //strip.trigger(); //this has a drawback, no effects slower than RefreshMs. advantage: Quick update, not dependant on effect time
#endif
} }