Added more usermod functions

This commit is contained in:
cschwinne 2018-04-24 12:03:25 +02:00
parent 16ce67057d
commit 356ff57005
4 changed files with 27 additions and 2 deletions

View File

@ -33,7 +33,7 @@
#include "WS2812FX.h"
//version in format yymmddb (b = daily build)
#define VERSION 1804151
#define VERSION 1804221
const String versionString = "0.6.4";
//AP and OTA default passwords (change them!)
@ -126,6 +126,8 @@ IPAddress hueIP = (0,0,0,0);
bool notifyHue = true;
bool hueApplyOnOff = true, hueApplyBri = true, hueApplyColor = true;
uint16_t userVar0 = 0, userVar1 = 0;
//Internal vars
byte col[]{0, 0, 0};
byte colOld[]{0, 0, 0};

View File

@ -817,7 +817,16 @@ bool handleSet(String req)
if (overlayCurrent == 4) strip.setCronixieBacklight(cronixieBacklight);
overlayRefreshedTime = 0;
}
pos = req.indexOf("U0="); //user var 0
if (pos > 0) {
userVar0 = req.substring(pos + 3).toInt();
}
pos = req.indexOf("U1="); //user var 1
if (pos > 0) {
userVar1 = req.substring(pos + 3).toInt();
}
//you can add more if you need
//internal call, does not send XML response
pos = req.indexOf("IN");
if (pos < 1) XML_response();

View File

@ -180,6 +180,10 @@ void wledInit()
val += "mA currently";
serveMessage(200,val,"This is just an estimate (does not take into account several factors like effects and wire resistance). It is NOT an accurate measurement!",254);
});
server.on("/u", HTTP_GET, [](){
if(!handleFileRead("/user.htm")) serveUserPage();
});
server.on("/teapot", HTTP_GET, [](){
serveMessage(418, "418. I'm a teapot.","(Tangible Embedded Advanced Project Of Twinkling)",254);

View File

@ -19,3 +19,13 @@ void userLoop()
}
//USER HTML
const char PAGE_usermod[] PROGMEM = R"=====(
<html><body>There is no usermod installed or it doesn't specify a custom web page.</body></html>
)=====";
void serveUserPage()
{
server.send(200, PAGE_usermod);
}