Interim Async Update
This commit is contained in:
parent
a371239172
commit
76f1c689c1
@ -6,7 +6,7 @@
|
||||
//see https://github.com/Aircoookie/WLED/issues/2 for flicker free ESP32 support
|
||||
|
||||
//PIN CONFIGURATION
|
||||
#define LEDPIN 2 //strip pin. Any for ESP32, gpio2 is recommended for ESP8266
|
||||
#define LEDPIN 3 //strip pin. Any for ESP32, gpio2 is recommended for ESP8266
|
||||
#define BTNPIN 0 //button pin. Needs to have pullup (gpio0 recommended)
|
||||
#define IR_PIN 4 //infrared pin.
|
||||
#define AUXPIN 15 //unused auxiliary output pin
|
||||
|
@ -33,15 +33,16 @@
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#include <WiFi.h>
|
||||
#include <ESPmDNS.h>
|
||||
#include "src/dependencies/webserver/WebServer.h"
|
||||
#include "src/dependencies/webserver/Webserver->h"
|
||||
#include <HTTPClient.h>
|
||||
/*#ifndef WLED_DISABLE_INFRARED
|
||||
#include <IRremote.h>
|
||||
#endif*/ //there are issues with ESP32 infrared, so it is disabled for now
|
||||
#else
|
||||
#define TEMPLATE_PLACEHOLDER '~'
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266mDNS.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#include <ESP8266Webserver.h>
|
||||
#include <ESP8266HTTPClient.h>
|
||||
#ifndef WLED_DISABLE_INFRARED
|
||||
#include <IRremoteESP8266.h>
|
||||
@ -52,10 +53,10 @@
|
||||
|
||||
#include <EEPROM.h>
|
||||
#include <WiFiUdp.h>
|
||||
#include <DNSServer.h>
|
||||
#include <DNSserver.h>
|
||||
#ifndef WLED_DISABLE_OTA
|
||||
#include <ArduinoOTA.h>
|
||||
#include "src/dependencies/webserver/ESP8266HTTPUpdateServer.h"
|
||||
#include "src/dependencies/webserver/ESP8266HTTPUpdateserver->h"
|
||||
#endif
|
||||
#include "src/dependencies/time/Time.h"
|
||||
#include "src/dependencies/time/TimeLib.h"
|
||||
@ -175,7 +176,7 @@ bool notifyTwice = false; //notifications use UDP: enable if
|
||||
bool alexaEnabled = true; //enable device discovery by Amazon Echo
|
||||
char alexaInvocationName[33] = "Light"; //speech control name of device. Choose something voice-to-text can understand
|
||||
|
||||
char blynkApiKey[36] = ""; //Auth token for Blynk server. If empty, no connection will be made
|
||||
char blynkApiKey[36] = ""; //Auth token for Blynk server-> If empty, no connection will be made
|
||||
|
||||
uint16_t realtimeTimeoutMs = 2500; //ms timeout of realtime mode before returning to normal mode
|
||||
int arlsOffset = 0; //realtime LED offset
|
||||
@ -499,7 +500,7 @@ void setup() {
|
||||
|
||||
//main program loop
|
||||
void loop() {
|
||||
server.handleClient();
|
||||
server->handleClient();
|
||||
handleSerial();
|
||||
handleNotifications();
|
||||
handleTransitions();
|
||||
@ -521,7 +522,7 @@ void loop() {
|
||||
|
||||
if (!realtimeActive) //block stuff if WARLS/Adalight is enabled
|
||||
{
|
||||
if (dnsActive) dnsServer.processNextRequest();
|
||||
if (dnsActive) dnsserver.processNextRequest();
|
||||
#ifndef WLED_DISABLE_OTA
|
||||
if (aOtaEnabled) ArduinoOTA.handle();
|
||||
#endif
|
||||
|
@ -79,7 +79,7 @@ void XML_response(bool isHTTP, bool includeTheme)
|
||||
oappend("</cf></th>");
|
||||
}
|
||||
oappend("</vs>");
|
||||
if (isHTTP) server.send(200, "text/xml", obuf);
|
||||
if (isHTTP) server->send(200, "text/xml", obuf);
|
||||
}
|
||||
|
||||
//append a numeric setting to string buffer
|
||||
|
@ -23,16 +23,16 @@ void handleSettingsSet(byte subPage)
|
||||
//WIFI SETTINGS
|
||||
if (subPage == 1)
|
||||
{
|
||||
strcpy(clientSSID,server.arg("CS").c_str());
|
||||
if (server.arg("CP").charAt(0) != '*') strcpy(clientPass, server.arg("CP").c_str());
|
||||
strcpy(clientSSID,server->arg("CS").c_str());
|
||||
if (server->arg("CP").charAt(0) != '*') strcpy(clientPass, server->arg("CP").c_str());
|
||||
|
||||
strcpy(cmDNS, server.arg("CM").c_str());
|
||||
strcpy(cmDNS, server->arg("CM").c_str());
|
||||
|
||||
int t = server.arg("AT").toInt(); if (t > 9 && t <= 255) apWaitTimeSecs = t;
|
||||
strcpy(apSSID, server.arg("AS").c_str());
|
||||
apHide = server.hasArg("AH");
|
||||
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;
|
||||
int t = server->arg("AT").toInt(); if (t > 9 && t <= 255) apWaitTimeSecs = t;
|
||||
strcpy(apSSID, server->arg("AS").c_str());
|
||||
apHide = server->hasArg("AH");
|
||||
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;
|
||||
|
||||
char k[3]; k[2] = 0;
|
||||
for (int i = 0; i<4; i++)
|
||||
@ -40,32 +40,32 @@ void handleSettingsSet(byte subPage)
|
||||
k[1] = i+48;//ascii 0,1,2,3
|
||||
|
||||
k[0] = 'I'; //static IP
|
||||
staticIP[i] = server.arg(k).toInt();
|
||||
staticIP[i] = server->arg(k).toInt();
|
||||
|
||||
k[0] = 'G'; //gateway
|
||||
staticGateway[i] = server.arg(k).toInt();
|
||||
staticGateway[i] = server->arg(k).toInt();
|
||||
|
||||
k[0] = 'S'; //subnet
|
||||
staticSubnet[i] = server.arg(k).toInt();
|
||||
staticSubnet[i] = server->arg(k).toInt();
|
||||
}
|
||||
}
|
||||
|
||||
//LED SETTINGS
|
||||
if (subPage == 2)
|
||||
{
|
||||
int t = server.arg("LC").toInt();
|
||||
int t = server->arg("LC").toInt();
|
||||
if (t > 0 && t <= 1200) ledCount = t;
|
||||
//RMT eats up too much RAM
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
if (ledCount > 600) ledCount = 600;
|
||||
#endif
|
||||
strip.ablMilliampsMax = server.arg("MA").toInt();
|
||||
useRGBW = server.hasArg("EW");
|
||||
strip.colorOrder = server.arg("CO").toInt();
|
||||
autoRGBtoRGBW = server.hasArg("AW");
|
||||
strip.ablMilliampsMax = server->arg("MA").toInt();
|
||||
useRGBW = server->hasArg("EW");
|
||||
strip.colorOrder = server->arg("CO").toInt();
|
||||
autoRGBtoRGBW = server->hasArg("AW");
|
||||
|
||||
//ignore settings and save current brightness, colors and fx as default
|
||||
if (server.hasArg("IS"))
|
||||
if (server->hasArg("IS"))
|
||||
{
|
||||
for (byte i=0; i<4; i++)
|
||||
{
|
||||
@ -78,122 +78,122 @@ void handleSettingsSet(byte subPage)
|
||||
effectIntensityDefault = effectIntensity;
|
||||
effectPaletteDefault = effectPalette;
|
||||
} else {
|
||||
colS[0] = server.arg("CR").toInt();
|
||||
colS[1] = server.arg("CG").toInt();
|
||||
colS[2] = server.arg("CB").toInt();
|
||||
colSecS[0] = server.arg("SR").toInt();
|
||||
colSecS[1] = server.arg("SG").toInt();
|
||||
colSecS[2] = server.arg("SB").toInt();
|
||||
colS[3] = server.arg("CW").toInt();
|
||||
colSecS[3] = server.arg("SW").toInt();
|
||||
briS = server.arg("CA").toInt();
|
||||
effectDefault = server.arg("FX").toInt();
|
||||
effectSpeedDefault = server.arg("SX").toInt();
|
||||
effectIntensityDefault = server.arg("IX").toInt();
|
||||
effectPaletteDefault = server.arg("FP").toInt();
|
||||
colS[0] = server->arg("CR").toInt();
|
||||
colS[1] = server->arg("CG").toInt();
|
||||
colS[2] = server->arg("CB").toInt();
|
||||
colSecS[0] = server->arg("SR").toInt();
|
||||
colSecS[1] = server->arg("SG").toInt();
|
||||
colSecS[2] = server->arg("SB").toInt();
|
||||
colS[3] = server->arg("CW").toInt();
|
||||
colSecS[3] = server->arg("SW").toInt();
|
||||
briS = server->arg("CA").toInt();
|
||||
effectDefault = server->arg("FX").toInt();
|
||||
effectSpeedDefault = server->arg("SX").toInt();
|
||||
effectIntensityDefault = server->arg("IX").toInt();
|
||||
effectPaletteDefault = server->arg("FP").toInt();
|
||||
}
|
||||
saveCurrPresetCycConf = server.hasArg("PC");
|
||||
turnOnAtBoot = server.hasArg("BO");
|
||||
t = server.arg("BP").toInt();
|
||||
saveCurrPresetCycConf = server->hasArg("PC");
|
||||
turnOnAtBoot = server->hasArg("BO");
|
||||
t = server->arg("BP").toInt();
|
||||
if (t <= 25) bootPreset = t;
|
||||
useGammaCorrectionBri = server.hasArg("GB");
|
||||
useGammaCorrectionRGB = server.hasArg("GC");
|
||||
useGammaCorrectionBri = server->hasArg("GB");
|
||||
useGammaCorrectionRGB = server->hasArg("GC");
|
||||
|
||||
fadeTransition = server.hasArg("TF");
|
||||
t = server.arg("TD").toInt();
|
||||
fadeTransition = server->hasArg("TF");
|
||||
t = server->arg("TD").toInt();
|
||||
if (t > 0) transitionDelay = t;
|
||||
transitionDelayDefault = t;
|
||||
strip.paletteFade = server.hasArg("PF");
|
||||
enableSecTransition = server.hasArg("T2");
|
||||
strip.paletteFade = server->hasArg("PF");
|
||||
enableSecTransition = server->hasArg("T2");
|
||||
|
||||
nightlightTargetBri = server.arg("TB").toInt();
|
||||
t = server.arg("TL").toInt();
|
||||
nightlightTargetBri = server->arg("TB").toInt();
|
||||
t = server->arg("TL").toInt();
|
||||
if (t > 0) nightlightDelayMinsDefault = t;
|
||||
nightlightFade = server.hasArg("TW");
|
||||
nightlightFade = server->hasArg("TW");
|
||||
|
||||
t = server.arg("PB").toInt();
|
||||
t = server->arg("PB").toInt();
|
||||
if (t >= 0 && t < 4) strip.paletteBlend = t;
|
||||
reverseMode = server.hasArg("RV");
|
||||
reverseMode = server->hasArg("RV");
|
||||
strip.setReverseMode(reverseMode);
|
||||
skipFirstLed = server.hasArg("SL");
|
||||
t = server.arg("BF").toInt();
|
||||
skipFirstLed = server->hasArg("SL");
|
||||
t = server->arg("BF").toInt();
|
||||
if (t > 0) briMultiplier = t;
|
||||
}
|
||||
|
||||
//UI
|
||||
if (subPage == 3)
|
||||
{
|
||||
int t = server.arg("UI").toInt();
|
||||
int t = server->arg("UI").toInt();
|
||||
if (t >= 0 && t < 3) uiConfiguration = t;
|
||||
strcpy(serverDescription, server.arg("DS").c_str());
|
||||
useHSBDefault = server.hasArg("MD");
|
||||
strcpy(serverDescription, server->arg("DS").c_str());
|
||||
useHSBDefault = server->hasArg("MD");
|
||||
useHSB = useHSBDefault;
|
||||
currentTheme = server.arg("TH").toInt();
|
||||
currentTheme = server->arg("TH").toInt();
|
||||
char k[3]; k[0]='C'; k[2]=0;
|
||||
for(int i=0;i<6;i++)
|
||||
{
|
||||
k[1] = i+48;
|
||||
strcpy(cssCol[i],server.arg(k).c_str());
|
||||
strcpy(cssCol[i],server->arg(k).c_str());
|
||||
}
|
||||
strcpy(cssFont,server.arg("CF").c_str());
|
||||
strcpy(cssFont,server->arg("CF").c_str());
|
||||
}
|
||||
|
||||
//SYNC
|
||||
if (subPage == 4)
|
||||
{
|
||||
buttonEnabled = server.hasArg("BT");
|
||||
irEnabled = server.hasArg("IR");
|
||||
int t = server.arg("UP").toInt();
|
||||
buttonEnabled = server->hasArg("BT");
|
||||
irEnabled = server->hasArg("IR");
|
||||
int t = server->arg("UP").toInt();
|
||||
if (t > 0) udpPort = t;
|
||||
receiveNotificationBrightness = server.hasArg("RB");
|
||||
receiveNotificationColor = server.hasArg("RC");
|
||||
receiveNotificationEffects = server.hasArg("RX");
|
||||
receiveNotificationBrightness = server->hasArg("RB");
|
||||
receiveNotificationColor = server->hasArg("RC");
|
||||
receiveNotificationEffects = server->hasArg("RX");
|
||||
receiveNotifications = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
||||
notifyDirectDefault = server.hasArg("SD");
|
||||
notifyDirectDefault = server->hasArg("SD");
|
||||
notifyDirect = notifyDirectDefault;
|
||||
notifyButton = server.hasArg("SB");
|
||||
notifyTwice = server.hasArg("S2");
|
||||
notifyButton = server->hasArg("SB");
|
||||
notifyTwice = server->hasArg("S2");
|
||||
|
||||
receiveDirect = server.hasArg("RD");
|
||||
e131Multicast = server.hasArg("EM");
|
||||
t = server.arg("EU").toInt();
|
||||
receiveDirect = server->hasArg("RD");
|
||||
e131Multicast = server->hasArg("EM");
|
||||
t = server->arg("EU").toInt();
|
||||
if (t > 0 && t <= 63999) e131Universe = t;
|
||||
t = server.arg("ET").toInt();
|
||||
t = server->arg("ET").toInt();
|
||||
if (t > 99 && t <= 65000) realtimeTimeoutMs = t;
|
||||
arlsForceMaxBri = server.hasArg("FB");
|
||||
arlsDisableGammaCorrection = server.hasArg("RG");
|
||||
t = server.arg("WO").toInt();
|
||||
arlsForceMaxBri = server->hasArg("FB");
|
||||
arlsDisableGammaCorrection = server->hasArg("RG");
|
||||
t = server->arg("WO").toInt();
|
||||
if (t >= -255 && t <= 255) arlsOffset = t;
|
||||
enableRealtimeUI = server.hasArg("RU");
|
||||
enableRealtimeUI = server->hasArg("RU");
|
||||
|
||||
alexaEnabled = server.hasArg("AL");
|
||||
strcpy(alexaInvocationName, server.arg("AI").c_str());
|
||||
notifyAlexa = server.hasArg("SA");
|
||||
alexaEnabled = server->hasArg("AL");
|
||||
strcpy(alexaInvocationName, server->arg("AI").c_str());
|
||||
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);
|
||||
}
|
||||
|
||||
strcpy(mqttServer, server.arg("MS").c_str());
|
||||
strcpy(mqttDeviceTopic, server.arg("MD").c_str());
|
||||
strcpy(mqttGroupTopic, server.arg("MG").c_str());
|
||||
strcpy(mqttServer, server->arg("MS").c_str());
|
||||
strcpy(mqttDeviceTopic, server->arg("MD").c_str());
|
||||
strcpy(mqttGroupTopic, server->arg("MG").c_str());
|
||||
|
||||
notifyHue = server.hasArg("SH");
|
||||
notifyHue = server->hasArg("SH");
|
||||
for (int i=0;i<4;i++){
|
||||
String a = "H"+String(i);
|
||||
hueIP[i] = server.arg(a).toInt();
|
||||
hueIP[i] = server->arg(a).toInt();
|
||||
}
|
||||
|
||||
t = server.arg("HL").toInt();
|
||||
t = server->arg("HL").toInt();
|
||||
if (t > 0) huePollLightId = t;
|
||||
|
||||
t = server.arg("HI").toInt();
|
||||
t = server->arg("HI").toInt();
|
||||
if (t > 50) huePollIntervalMs = t;
|
||||
|
||||
hueApplyOnOff = server.hasArg("HO");
|
||||
hueApplyBri = server.hasArg("HB");
|
||||
hueApplyColor = server.hasArg("HC");
|
||||
if (server.hasArg("HP"))
|
||||
hueApplyOnOff = server->hasArg("HO");
|
||||
hueApplyBri = server->hasArg("HB");
|
||||
hueApplyColor = server->hasArg("HC");
|
||||
if (server->hasArg("HP"))
|
||||
{
|
||||
if (!huePollingEnabled) hueAttempt = true;
|
||||
if (!setupHue()) hueAttempt = true;
|
||||
@ -207,54 +207,54 @@ void handleSettingsSet(byte subPage)
|
||||
//TIME
|
||||
if (subPage == 5)
|
||||
{
|
||||
ntpEnabled = server.hasArg("NT");
|
||||
useAMPM = !server.hasArg("CF");
|
||||
currentTimezone = server.arg("TZ").toInt();
|
||||
utcOffsetSecs = server.arg("UO").toInt();
|
||||
ntpEnabled = server->hasArg("NT");
|
||||
useAMPM = !server->hasArg("CF");
|
||||
currentTimezone = server->arg("TZ").toInt();
|
||||
utcOffsetSecs = server->arg("UO").toInt();
|
||||
|
||||
//start ntp if not already connected
|
||||
if (ntpEnabled && WiFi.status() == WL_CONNECTED && !ntpConnected) ntpConnected = ntpUdp.begin(ntpLocalPort);
|
||||
|
||||
if (server.hasArg("OL")){
|
||||
overlayDefault = server.arg("OL").toInt();
|
||||
if (server->hasArg("OL")){
|
||||
overlayDefault = server->arg("OL").toInt();
|
||||
if (overlayCurrent != overlayDefault) strip.unlockAll();
|
||||
overlayCurrent = overlayDefault;
|
||||
}
|
||||
|
||||
overlayMin = server.arg("O1").toInt();
|
||||
overlayMax = server.arg("O2").toInt();
|
||||
analogClock12pixel = server.arg("OM").toInt();
|
||||
analogClock5MinuteMarks = server.hasArg("O5");
|
||||
analogClockSecondsTrail = server.hasArg("OS");
|
||||
overlayMin = server->arg("O1").toInt();
|
||||
overlayMax = server->arg("O2").toInt();
|
||||
analogClock12pixel = server->arg("OM").toInt();
|
||||
analogClock5MinuteMarks = server->hasArg("O5");
|
||||
analogClockSecondsTrail = server->hasArg("OS");
|
||||
|
||||
strcpy(cronixieDisplay,server.arg("CX").c_str());
|
||||
strcpy(cronixieDisplay,server->arg("CX").c_str());
|
||||
bool cbOld = cronixieBacklight;
|
||||
cronixieBacklight = server.hasArg("CB");
|
||||
cronixieBacklight = server->hasArg("CB");
|
||||
if (cbOld != cronixieBacklight && overlayCurrent == 3)
|
||||
{
|
||||
strip.setCronixieBacklight(cronixieBacklight); overlayRefreshedTime = 0;
|
||||
}
|
||||
countdownMode = server.hasArg("CE");
|
||||
countdownYear = server.arg("CY").toInt();
|
||||
countdownMonth = server.arg("CI").toInt();
|
||||
countdownDay = server.arg("CD").toInt();
|
||||
countdownHour = server.arg("CH").toInt();
|
||||
countdownMin = server.arg("CM").toInt();
|
||||
countdownSec = server.arg("CS").toInt();
|
||||
countdownMode = server->hasArg("CE");
|
||||
countdownYear = server->arg("CY").toInt();
|
||||
countdownMonth = server->arg("CI").toInt();
|
||||
countdownDay = server->arg("CD").toInt();
|
||||
countdownHour = server->arg("CH").toInt();
|
||||
countdownMin = server->arg("CM").toInt();
|
||||
countdownSec = server->arg("CS").toInt();
|
||||
|
||||
for (int i=1;i<17;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);
|
||||
}
|
||||
|
||||
macroBoot = server.arg("MB").toInt();
|
||||
macroAlexaOn = server.arg("A0").toInt();
|
||||
macroAlexaOff = server.arg("A1").toInt();
|
||||
macroButton = server.arg("MP").toInt();
|
||||
macroLongPress = server.arg("ML").toInt();
|
||||
macroCountdown = server.arg("MC").toInt();
|
||||
macroNl = server.arg("MN").toInt();
|
||||
macroBoot = server->arg("MB").toInt();
|
||||
macroAlexaOn = server->arg("A0").toInt();
|
||||
macroAlexaOff = server->arg("A1").toInt();
|
||||
macroButton = server->arg("MP").toInt();
|
||||
macroLongPress = server->arg("ML").toInt();
|
||||
macroCountdown = server->arg("MC").toInt();
|
||||
macroNl = server->arg("MN").toInt();
|
||||
|
||||
char k[3]; k[2] = 0;
|
||||
for (int i = 0; i<8; i++)
|
||||
@ -262,23 +262,23 @@ void handleSettingsSet(byte subPage)
|
||||
k[1] = i+48;//ascii 0,1,2,3
|
||||
|
||||
k[0] = 'H'; //timer hours
|
||||
timerHours[i] = server.arg(k).toInt();
|
||||
timerHours[i] = server->arg(k).toInt();
|
||||
|
||||
k[0] = 'N'; //minutes
|
||||
timerMinutes[i] = server.arg(k).toInt();
|
||||
timerMinutes[i] = server->arg(k).toInt();
|
||||
|
||||
k[0] = 'T'; //macros
|
||||
timerMacro[i] = server.arg(k).toInt();
|
||||
timerMacro[i] = server->arg(k).toInt();
|
||||
|
||||
k[0] = 'W'; //weekdays
|
||||
timerWeekday[i] = server.arg(k).toInt();
|
||||
timerWeekday[i] = server->arg(k).toInt();
|
||||
}
|
||||
}
|
||||
|
||||
//SECURITY
|
||||
if (subPage == 6)
|
||||
{
|
||||
if (server.hasArg("RS")) //complete factory reset
|
||||
if (server->hasArg("RS")) //complete factory reset
|
||||
{
|
||||
clearEEPROM();
|
||||
serveMessage(200, "All Settings erased.", "Connect to WLED-AP to setup again",255);
|
||||
@ -286,24 +286,24 @@ void handleSettingsSet(byte subPage)
|
||||
}
|
||||
|
||||
bool pwdCorrect = !otaLock; //always allow access if ota not locked
|
||||
if (server.hasArg("OP"))
|
||||
if (server->hasArg("OP"))
|
||||
{
|
||||
if (otaLock && strcmp(otaPass,server.arg("OP").c_str()) == 0)
|
||||
if (otaLock && strcmp(otaPass,server->arg("OP").c_str()) == 0)
|
||||
{
|
||||
pwdCorrect = true;
|
||||
}
|
||||
if (!otaLock && server.arg("OP").length() > 0)
|
||||
if (!otaLock && server->arg("OP").length() > 0)
|
||||
{
|
||||
strcpy(otaPass,server.arg("OP").c_str());
|
||||
strcpy(otaPass,server->arg("OP").c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (pwdCorrect) //allow changes if correct pwd or no ota active
|
||||
{
|
||||
otaLock = server.hasArg("NO");
|
||||
wifiLock = server.hasArg("OW");
|
||||
recoveryAPDisabled = server.hasArg("NA");
|
||||
aOtaEnabled = server.hasArg("AO");
|
||||
otaLock = server->hasArg("NO");
|
||||
wifiLock = server->hasArg("OW");
|
||||
recoveryAPDisabled = server->hasArg("NA");
|
||||
aOtaEnabled = server->hasArg("AO");
|
||||
}
|
||||
}
|
||||
saveSettingsToEEPROM();
|
||||
|
@ -52,7 +52,7 @@ String formatBytes(size_t bytes){
|
||||
}
|
||||
|
||||
String getContentType(String filename){
|
||||
if(server.hasArg("download")) return "application/octet-stream";
|
||||
if(server->hasArg("download")) return "application/octet-stream";
|
||||
else if(filename.endsWith(".htm")) return "text/html";
|
||||
else if(filename.endsWith(".html")) return "text/html";
|
||||
else if(filename.endsWith(".css")) return "text/css";
|
||||
@ -77,7 +77,7 @@ bool handleFileRead(String path){
|
||||
if(SPIFFS.exists(pathWithGz))
|
||||
path += ".gz";
|
||||
File file = SPIFFS.open(path, "r");
|
||||
size_t sent = server.streamFile(file, contentType);
|
||||
size_t sent = server->streamFile(file, contentType);
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
@ -85,8 +85,8 @@ bool handleFileRead(String path){
|
||||
}
|
||||
|
||||
void handleFileUpload(){
|
||||
if(server.uri() != "/edit") return;
|
||||
HTTPUpload& upload = server.upload();
|
||||
if(server->uri() != "/edit") return;
|
||||
HTTPUpload& upload = server->upload();
|
||||
if(upload.status == UPLOAD_FILE_START){
|
||||
String filename = upload.filename;
|
||||
if(!filename.startsWith("/")) filename = "/"+filename;
|
||||
@ -105,22 +105,22 @@ void handleFileUpload(){
|
||||
}
|
||||
|
||||
void handleFileDelete(){
|
||||
if(server.args() == 0) return server.send(500, "text/plain", "BAD ARGS");
|
||||
String path = server.arg(0);
|
||||
if(server->args() == 0) return server->send(500, "text/plain", "BAD ARGS");
|
||||
String path = server->arg(0);
|
||||
DEBUG_PRINTLN("handleFileDelete: " + path);
|
||||
if(path == "/")
|
||||
return server.send(500, "text/plain", "BAD PATH");
|
||||
return server->send(500, "text/plain", "BAD PATH");
|
||||
if(!SPIFFS.exists(path))
|
||||
return server.send(404, "text/plain", "FileNotFound");
|
||||
return server->send(404, "text/plain", "FileNotFound");
|
||||
SPIFFS.remove(path);
|
||||
server.send(200, "text/plain", "");
|
||||
server->send(200, "text/plain", "");
|
||||
path = String();
|
||||
}
|
||||
|
||||
void handleFileList() {
|
||||
if(!server.hasArg("dir")) {server.send(500, "text/plain", "BAD ARGS"); return;}
|
||||
if(!server->hasArg("dir")) {server->send(500, "text/plain", "BAD ARGS"); return;}
|
||||
|
||||
String path = server.arg("dir");
|
||||
String path = server->arg("dir");
|
||||
DEBUG_PRINTLN("handleFileList: " + path);
|
||||
Dir dir = SPIFFS.openDir(path);
|
||||
path = String();
|
||||
@ -139,24 +139,24 @@ void handleFileList() {
|
||||
}
|
||||
|
||||
output += "]";
|
||||
server.send(200, "text/json", output);
|
||||
server->send(200, "text/json", output);
|
||||
}
|
||||
|
||||
void handleFileCreate(){
|
||||
if(server.args() == 0)
|
||||
return server.send(500, "text/plain", "BAD ARGS");
|
||||
String path = server.arg(0);
|
||||
if(server->args() == 0)
|
||||
return server->send(500, "text/plain", "BAD ARGS");
|
||||
String path = server->arg(0);
|
||||
DEBUG_PRINTLN("handleFileCreate: " + path);
|
||||
if(path == "/")
|
||||
return server.send(500, "text/plain", "BAD PATH");
|
||||
return server->send(500, "text/plain", "BAD PATH");
|
||||
if(SPIFFS.exists(path))
|
||||
return server.send(500, "text/plain", "FILE EXISTS");
|
||||
return server->send(500, "text/plain", "FILE EXISTS");
|
||||
File file = SPIFFS.open(path, "w");
|
||||
if(file)
|
||||
file.close();
|
||||
else
|
||||
return server.send(500, "text/plain", "CREATE FAILED");
|
||||
server.send(200, "text/plain", "");
|
||||
return server->send(500, "text/plain", "CREATE FAILED");
|
||||
server->send(200, "text/plain", "");
|
||||
path = String();
|
||||
}
|
||||
|
||||
|
@ -52,8 +52,8 @@ void wledInit()
|
||||
//start captive portal if AP active
|
||||
if (onlyAP || strlen(apSSID) > 0)
|
||||
{
|
||||
dnsServer.setErrorReplyCode(DNSReplyCode::ServerFailure);
|
||||
dnsServer.start(53, "wled.me", WiFi.softAPIP());
|
||||
dnsserver.setErrorReplyCode(DNSReplyCode::ServerFailure);
|
||||
dnsserver.start(53, "wled.me", WiFi.softAPIP());
|
||||
dnsActive = true;
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ void wledInit()
|
||||
//init Alexa hue emulation
|
||||
if (alexaEnabled && !onlyAP) alexaInit();
|
||||
|
||||
server.begin();
|
||||
server->begin();
|
||||
DEBUG_PRINTLN("HTTP server started");
|
||||
|
||||
//init ArduinoOTA
|
||||
@ -272,7 +272,7 @@ void getBuildInfo()
|
||||
oappend("\r\nstrip-pin: gpio");
|
||||
oappendi(LEDPIN);
|
||||
oappend("\r\nbrand: wled");
|
||||
oappend("\r\nbuild-type: src\r\n");
|
||||
oappend("\r\nbuild-type: dev\r\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,11 +4,14 @@
|
||||
|
||||
void initServer()
|
||||
{
|
||||
//CORS compatiblity
|
||||
DefaultHeaders::Instance().addHeader("Access-Control-Allow-Origin", "*");
|
||||
|
||||
//settings page
|
||||
server.on("/settings", HTTP_GET, [](){
|
||||
server->on("/settings", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveSettings(0);
|
||||
});
|
||||
server.on("/settings/wifi", HTTP_GET, [](){
|
||||
server->on("/settings/wifi", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
if (!(wifiLock && otaLock))
|
||||
{
|
||||
serveSettings(1);
|
||||
@ -16,57 +19,57 @@ void initServer()
|
||||
serveMessage(500, "Access Denied", txd, 254);
|
||||
}
|
||||
});
|
||||
server.on("/settings/leds", HTTP_GET, [](){
|
||||
server->on("/settings/leds", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveSettings(2);
|
||||
});
|
||||
server.on("/settings/ui", HTTP_GET, [](){
|
||||
server->on("/settings/ui", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveSettings(3);
|
||||
});
|
||||
server.on("/settings/sync", HTTP_GET, [](){
|
||||
server->on("/settings/sync", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveSettings(4);
|
||||
});
|
||||
server.on("/settings/time", HTTP_GET, [](){
|
||||
server->on("/settings/time", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveSettings(5);
|
||||
});
|
||||
server.on("/settings/sec", HTTP_GET, [](){
|
||||
server->on("/settings/sec", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveSettings(6);
|
||||
});
|
||||
|
||||
server.on("/favicon.ico", HTTP_GET, [](){
|
||||
server->on("/favicon.ico", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
if(!handleFileRead("/favicon.ico"))
|
||||
{
|
||||
server.send_P(200, "image/x-icon", favicon, 156);
|
||||
server->send_P(200, "image/x-icon", favicon, 156);
|
||||
}
|
||||
});
|
||||
|
||||
server.on("/sliders", HTTP_GET, serveIndex);
|
||||
server->on("/sliders", HTTP_GET, serveIndex);
|
||||
|
||||
server.on("/welcome", HTTP_GET, [](){
|
||||
server->on("/welcome", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveSettings(255);
|
||||
});
|
||||
|
||||
server.on("/reset", HTTP_GET, [](){
|
||||
server->on("/reset", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveMessage(200,"Rebooting now...","(takes ~20 seconds, wait for auto-redirect)",79);
|
||||
reset();
|
||||
});
|
||||
|
||||
server.on("/settings/wifi", HTTP_POST, [](){
|
||||
server->on("/settings/wifi", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||
if (!(wifiLock && otaLock)) handleSettingsSet(1);
|
||||
serveMessage(200,"WiFi settings saved.","Rebooting now...",255);
|
||||
reset();
|
||||
});
|
||||
|
||||
server.on("/settings/leds", HTTP_POST, [](){
|
||||
server->on("/settings/leds", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||
handleSettingsSet(2);
|
||||
serveMessage(200,"LED settings saved.","Redirecting...",1);
|
||||
});
|
||||
|
||||
server.on("/settings/ui", HTTP_POST, [](){
|
||||
server->on("/settings/ui", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||
handleSettingsSet(3);
|
||||
serveMessage(200,"UI settings saved.","Reloading to apply theme...",122);
|
||||
});
|
||||
|
||||
server.on("/settings/sync", HTTP_POST, [](){
|
||||
server->on("/settings/sync", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||
handleSettingsSet(4);
|
||||
if (hueAttempt)
|
||||
{
|
||||
@ -77,46 +80,46 @@ void initServer()
|
||||
hueAttempt = false;
|
||||
});
|
||||
|
||||
server.on("/settings/time", HTTP_POST, [](){
|
||||
server->on("/settings/time", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||
handleSettingsSet(5);
|
||||
serveMessage(200,"Time settings saved.","Redirecting...",1);
|
||||
});
|
||||
|
||||
server.on("/settings/sec", HTTP_POST, [](){
|
||||
server->on("/settings/sec", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||
handleSettingsSet(6);
|
||||
serveMessage(200,"Security settings saved.","Rebooting now... (takes ~20 seconds, wait for auto-redirect)",139);
|
||||
reset();
|
||||
});
|
||||
|
||||
server.on("/json", HTTP_ANY, [](){
|
||||
server.send(500, "application/json", "{\"error\":\"Not implemented\"}");
|
||||
server->on("/json", HTTP_ANY, [](AsyncWebServerRequest *request){
|
||||
server->send(500, "application/json", "{\"error\":\"Not implemented\"}");
|
||||
});
|
||||
|
||||
server.on("/json/effects", HTTP_GET, [](){
|
||||
server.setContentLength(strlen_P(JSON_mode_names));
|
||||
server.send(200, "application/json", "");
|
||||
server.sendContent_P(JSON_mode_names);
|
||||
server->on("/json/effects", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
server->setContentLength(strlen_P(JSON_mode_names));
|
||||
server->send(200, "application/json", "");
|
||||
server->sendContent_P(JSON_mode_names);
|
||||
});
|
||||
|
||||
server.on("/json/palettes", HTTP_GET, [](){
|
||||
server.setContentLength(strlen_P(JSON_palette_names));
|
||||
server.send(200, "application/json", "");
|
||||
server.sendContent_P(JSON_palette_names);
|
||||
server->on("/json/palettes", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
server->setContentLength(strlen_P(JSON_palette_names));
|
||||
server->send(200, "application/json", "");
|
||||
server->sendContent_P(JSON_palette_names);
|
||||
});
|
||||
|
||||
server.on("/version", HTTP_GET, [](){
|
||||
server.send(200, "text/plain", (String)VERSION);
|
||||
server->on("/version", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
request->send(200, "text/plain", (String)VERSION);
|
||||
});
|
||||
|
||||
server.on("/uptime", HTTP_GET, [](){
|
||||
server.send(200, "text/plain", (String)millis());
|
||||
server->on("/uptime", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
request->send(200, "text/plain", (String)millis());
|
||||
});
|
||||
|
||||
server.on("/freeheap", HTTP_GET, [](){
|
||||
server.send(200, "text/plain", (String)ESP.getFreeHeap());
|
||||
server->on("/freeheap", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
request->send(200, "text/plain", (String)ESP.getFreeHeap());
|
||||
});
|
||||
|
||||
server.on("/power", HTTP_GET, [](){
|
||||
server->on("/power", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
String val = "";
|
||||
if (strip.currentMilliamps == 0)
|
||||
{
|
||||
@ -129,95 +132,95 @@ void initServer()
|
||||
serveMessage(200, val, "This is just an estimate (does not account for factors like wire resistance). It is NOT a measurement!", 254);
|
||||
});
|
||||
|
||||
server.on("/u", HTTP_GET, [](){
|
||||
server.setContentLength(strlen_P(PAGE_usermod));
|
||||
server.send(200, "text/html", "");
|
||||
server.sendContent_P(PAGE_usermod);
|
||||
server->on("/u", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
server->setContentLength(strlen_P(PAGE_usermod));
|
||||
server->send(200, "text/html", "");
|
||||
server->sendContent_P(PAGE_usermod);
|
||||
});
|
||||
|
||||
server.on("/teapot", HTTP_GET, [](){
|
||||
server->on("/teapot", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveMessage(418, "418. I'm a teapot.", "(Tangible Embedded Advanced Project Of Twinkling)", 254);
|
||||
});
|
||||
|
||||
server.on("/build", HTTP_GET, [](){
|
||||
server->on("/build", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
getBuildInfo();
|
||||
server.send(200, "text/plain", obuf);
|
||||
request->send(200, "text/plain", obuf);
|
||||
});
|
||||
//if OTA is allowed
|
||||
if (!otaLock){
|
||||
server.on("/edit", HTTP_GET, [](){
|
||||
server.send(200, "text/html", PAGE_edit);
|
||||
server->on("/edit", HTTP_GET, [](){
|
||||
server->send(200, "text/html", PAGE_edit);
|
||||
});
|
||||
#ifdef USEFS
|
||||
server.on("/edit", HTTP_PUT, handleFileCreate);
|
||||
server.on("/edit", HTTP_DELETE, handleFileDelete);
|
||||
server.on("/edit", HTTP_POST, [](){ server.send(200, "text/plain", ""); }, handleFileUpload);
|
||||
server.on("/list", HTTP_GET, handleFileList);
|
||||
server->on("/edit", HTTP_PUT, handleFileCreate);
|
||||
server->on("/edit", HTTP_DELETE, handleFileDelete);
|
||||
server->on("/edit", HTTP_POST, [](){ server->send(200, "text/plain", ""); }, handleFileUpload);
|
||||
server->on("/list", HTTP_GET, handleFileList);
|
||||
#endif
|
||||
//init ota page
|
||||
#ifndef WLED_DISABLE_OTA
|
||||
httpUpdater.setup(&server);
|
||||
#else
|
||||
server.on("/update", HTTP_GET, [](){
|
||||
server->on("/update", HTTP_GET, [](){
|
||||
serveMessage(500, "Not implemented", "OTA updates are unsupported in this build.", 254);
|
||||
});
|
||||
#endif
|
||||
} else
|
||||
{
|
||||
server.on("/edit", HTTP_GET, [](){
|
||||
server->on("/edit", HTTP_GET, [](){
|
||||
serveMessage(500, "Access Denied", txd, 254);
|
||||
});
|
||||
server.on("/update", HTTP_GET, [](){
|
||||
server->on("/update", HTTP_GET, [](){
|
||||
serveMessage(500, "Access Denied", txd, 254);
|
||||
});
|
||||
server.on("/list", HTTP_GET, [](){
|
||||
server->on("/list", HTTP_GET, [](){
|
||||
serveMessage(500, "Access Denied", txd, 254);
|
||||
});
|
||||
}
|
||||
|
||||
//this ceased working somehow
|
||||
/*server.on("/", HTTP_GET, [](){
|
||||
/*server->on("/", HTTP_GET, [](){
|
||||
serveIndexOrWelcome();
|
||||
});*/
|
||||
|
||||
//called when the url is not defined here, ajax-in; get-settings
|
||||
server.onNotFound([](){
|
||||
server->onNotFound([](){
|
||||
DEBUG_PRINTLN("Not-Found HTTP call:");
|
||||
DEBUG_PRINTLN("URI: " + server.uri());
|
||||
DEBUG_PRINTLN("Body: " + server.arg(0));
|
||||
DEBUG_PRINTLN("URI: " + server->uri());
|
||||
DEBUG_PRINTLN("Body: " + server->arg(0));
|
||||
|
||||
//make API CORS compatible
|
||||
if (server.method() == HTTP_OPTIONS)
|
||||
if (server->method() == HTTP_OPTIONS)
|
||||
{
|
||||
server.sendHeader("Access-Control-Allow-Origin", "*");
|
||||
server.sendHeader("Access-Control-Max-Age", "10000");
|
||||
server.sendHeader("Access-Control-Allow-Methods", "PUT,POST,GET,OPTIONS");
|
||||
server.sendHeader("Access-Control-Allow-Headers", "*");
|
||||
server.send(200);
|
||||
server->sendHeader("Access-Control-Allow-Origin", "*");
|
||||
server->sendHeader("Access-Control-Max-Age", "10000");
|
||||
server->sendHeader("Access-Control-Allow-Methods", "PUT,POST,GET,OPTIONS");
|
||||
server->sendHeader("Access-Control-Allow-Headers", "*");
|
||||
server->send(200);
|
||||
return;
|
||||
}
|
||||
|
||||
//workaround for subpage issue
|
||||
if (server.uri().length() == 1)
|
||||
if (server->uri().length() == 1)
|
||||
{
|
||||
serveIndexOrWelcome();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!handleSet(server.uri())){
|
||||
if(!handleSet(server->uri())){
|
||||
#ifndef WLED_DISABLE_ALEXA
|
||||
if(!espalexa.handleAlexaApiCall(server.uri(),server.arg(0)))
|
||||
if(!espalexa.handleAlexaApiCall(server->uri(),server->arg(0)))
|
||||
#endif
|
||||
server.send(404, "text/plain", "Not Found");
|
||||
server->send(404, "text/plain", "Not Found");
|
||||
}
|
||||
});
|
||||
|
||||
#ifndef ARDUINO_ARCH_ESP32
|
||||
const char * headerkeys[] = {"User-Agent"};
|
||||
server.collectHeaders(headerkeys,sizeof(headerkeys)/sizeof(char*));
|
||||
server->collectHeaders(headerkeys,sizeof(headerkeys)/sizeof(char*));
|
||||
#else
|
||||
String ua = "User-Agent";
|
||||
server.collectHeaders(ua);
|
||||
server->collectHeaders(ua);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -249,7 +252,7 @@ void serveRealtimeError(bool settings)
|
||||
}
|
||||
}
|
||||
mesg += ").";
|
||||
server.send(200, "text/plain", mesg);
|
||||
server->send(200, "text/plain", mesg);
|
||||
}
|
||||
|
||||
|
||||
@ -271,7 +274,7 @@ void getCSSColors()
|
||||
void serveIndex()
|
||||
{
|
||||
bool serveMobile = false;
|
||||
if (uiConfiguration == 0) serveMobile = checkClientIsMobile(server.header("User-Agent"));
|
||||
if (uiConfiguration == 0) serveMobile = checkClientIsMobile(server->header("User-Agent"));
|
||||
else if (uiConfiguration == 2) serveMobile = true;
|
||||
|
||||
if (realtimeActive && !enableRealtimeUI) //do not serve while receiving realtime
|
||||
@ -282,12 +285,12 @@ void serveIndex()
|
||||
|
||||
//error message is not gzipped
|
||||
#ifdef WLED_DISABLE_MOBILE_UI
|
||||
if (!serveMobile) server.sendHeader("Content-Encoding","gzip");
|
||||
if (!serveMobile) server->sendHeader("Content-Encoding","gzip");
|
||||
#else
|
||||
server.sendHeader("Content-Encoding","gzip");
|
||||
server->sendHeader("Content-Encoding","gzip");
|
||||
#endif
|
||||
|
||||
server.send_P(200, "text/html",
|
||||
server->send_P(200, "text/html",
|
||||
(serveMobile) ? PAGE_indexM : PAGE_index0,
|
||||
(serveMobile) ? PAGE_indexM_L : PAGE_index0_L);
|
||||
}
|
||||
@ -319,12 +322,12 @@ void serveMessage(int code, String headl, String subl="", int optionType)
|
||||
messageBody += "<script>setTimeout(RP," + String((optionType-120)*1000) + ")</script>";
|
||||
}
|
||||
messageBody += "</body></html>";
|
||||
server.setContentLength(strlen_P(PAGE_msg0) + olen + strlen_P(PAGE_msg1) + messageBody.length());
|
||||
server.send(code, "text/html", "");
|
||||
server.sendContent_P(PAGE_msg0);
|
||||
server.sendContent(obuf);
|
||||
server.sendContent_P(PAGE_msg1);
|
||||
server.sendContent(messageBody);
|
||||
server->setContentLength(strlen_P(PAGE_msg0) + olen + strlen_P(PAGE_msg1) + messageBody.length());
|
||||
server->send(code, "text/html", "");
|
||||
server->sendContent_P(PAGE_msg0);
|
||||
server->sendContent(obuf);
|
||||
server->sendContent_P(PAGE_msg1);
|
||||
server->sendContent(messageBody);
|
||||
}
|
||||
|
||||
|
||||
@ -359,32 +362,32 @@ void serveSettings(byte subPage)
|
||||
|
||||
getCSSColors();
|
||||
|
||||
server.setContentLength(pl0 + olen + sCssLength + pl1);
|
||||
server.send(200, "text/html", "");
|
||||
server->setContentLength(pl0 + olen + sCssLength + pl1);
|
||||
server->send(200, "text/html", "");
|
||||
|
||||
switch (subPage)
|
||||
{
|
||||
case 1: server.sendContent_P(PAGE_settings_wifi0); break;
|
||||
case 2: server.sendContent_P(PAGE_settings_leds0); break;
|
||||
case 3: server.sendContent_P(PAGE_settings_ui0 ); break;
|
||||
case 4: server.sendContent_P(PAGE_settings_sync0); break;
|
||||
case 5: server.sendContent_P(PAGE_settings_time0); break;
|
||||
case 6: server.sendContent_P(PAGE_settings_sec0 ); break;
|
||||
case 255: server.sendContent_P(PAGE_welcome0 ); break;
|
||||
default: server.sendContent_P(PAGE_settings0 );
|
||||
case 1: server->sendContent_P(PAGE_settings_wifi0); break;
|
||||
case 2: server->sendContent_P(PAGE_settings_leds0); break;
|
||||
case 3: server->sendContent_P(PAGE_settings_ui0 ); break;
|
||||
case 4: server->sendContent_P(PAGE_settings_sync0); break;
|
||||
case 5: server->sendContent_P(PAGE_settings_time0); break;
|
||||
case 6: server->sendContent_P(PAGE_settings_sec0 ); break;
|
||||
case 255: server->sendContent_P(PAGE_welcome0 ); break;
|
||||
default: server->sendContent_P(PAGE_settings0 );
|
||||
}
|
||||
server.sendContent(obuf);
|
||||
server->sendContent(obuf);
|
||||
|
||||
if (subPage >0 && subPage <7) server.sendContent_P(PAGE_settingsCss);
|
||||
if (subPage >0 && subPage <7) server->sendContent_P(PAGE_settingsCss);
|
||||
switch (subPage)
|
||||
{
|
||||
case 1: server.sendContent_P(PAGE_settings_wifi1); break;
|
||||
case 2: server.sendContent_P(PAGE_settings_leds1); break;
|
||||
case 3: server.sendContent_P(PAGE_settings_ui1 ); break;
|
||||
case 4: server.sendContent_P(PAGE_settings_sync1); break;
|
||||
case 5: server.sendContent_P(PAGE_settings_time1); break;
|
||||
case 6: server.sendContent_P(PAGE_settings_sec1 ); break;
|
||||
case 255: server.sendContent_P(PAGE_welcome1 ); break;
|
||||
default: server.sendContent_P(PAGE_settings1 );
|
||||
case 1: server->sendContent_P(PAGE_settings_wifi1); break;
|
||||
case 2: server->sendContent_P(PAGE_settings_leds1); break;
|
||||
case 3: server->sendContent_P(PAGE_settings_ui1 ); break;
|
||||
case 4: server->sendContent_P(PAGE_settings_sync1); break;
|
||||
case 5: server->sendContent_P(PAGE_settings_time1); break;
|
||||
case 6: server->sendContent_P(PAGE_settings_sec1 ); break;
|
||||
case 255: server->sendContent_P(PAGE_welcome1 ); break;
|
||||
default: server->sendContent_P(PAGE_settings1 );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user