Added Macro notification option

Removed realtime UI lock
This commit is contained in:
cschwinne 2019-02-19 12:57:50 +01:00
parent c34ddb2bc3
commit ba19e20833
7 changed files with 33 additions and 48 deletions

Binary file not shown.

View File

@ -221,7 +221,8 @@ Send notifications on direct change: <input type="checkbox" name="SD"><br>
Send notifications on button press: <input type="checkbox" name="SB"><br>
Send Alexa notifications: <input type="checkbox" name="SA"><br>
Send Philips Hue change notifications: <input type="checkbox" name="SH"><br>
Send notifications twice: <input type="checkbox" name="S2"><br>
Send Macro notifications: <input type="checkbox" name="SM"><br>
Send notifications twice: <input type="checkbox" name="S2">
<h3>Realtime</h3>
Receive UDP realtime: <input type="checkbox" name="RD"><br><br>
<i>E1.31 (sACN)</i><br>
@ -231,14 +232,13 @@ E1.31 start universe: <input name="EU" type="number" min="1" max="63999" require
Timeout: <input name="ET" type="number" min="1" max="65000" required> ms<br>
Force max brightness: <input type="checkbox" name="FB"><br>
Disable realtime gamma correction: <input type="checkbox" name="RG"><br>
Realtime LED offset: <input name="WO" type="number" min="-255" max="255" required><br>
Enable UI access during realtime: <input type="checkbox" name="RU"> (can cause issues)
Realtime LED offset: <input name="WO" type="number" min="-255" max="255" required>
<h3>Alexa Voice Assistant</h3>
Emulate Alexa device: <input type="checkbox" name="AL"><br>
Alexa invocation name: <input name="AI" maxlength="32">
<h3>Blynk</h3>
<b>Blynk, MQTT and Hue sync all connect to external hosts!<br>
This impacts the responsiveness of the ESP8266.</b><br>
This may impact the responsiveness of the ESP8266.</b><br>
For best results, only use one of these services at a time.<br>
(alternatively, connect a second ESP to them and use the UDP sync)<br><br>
Device Auth token: <input name="BK" maxlength="33"><br>
@ -385,7 +385,7 @@ HTTP traffic is unencrypted. An attacker in the same network can intercept form
<button type="button" onclick="U()">Manual OTA Update</button><br>
Enable ArduinoOTA: <input type="checkbox" name="AO"><br>
<h3>About</h3>
<a href="https://github.com/Aircoookie/WLED" target="_blank">WLED</a> version 0.8.3<br><br>
<a href="https://github.com/Aircoookie/WLED" target="_blank">WLED</a> version 0.8.4-dev<br><br>
<a href="https://github.com/Aircoookie/WLED/wiki/Contributors-&-About" target="_blank">Contributors, dependencies and special thanks</a><br>
A huge thank you to everyone who helped me create WLED!<br><br>
(c) 2016-2019 Christian Schwinne <br>

View File

@ -3,7 +3,7 @@
*/
/*
* @title WLED project sketch
* @version 0.8.3
* @version 0.8.4-dev
* @author Christian Schwinne
*/
@ -80,7 +80,7 @@
//version code in format yymmddb (b = daily build)
#define VERSION 1902181
#define VERSION 1902191
char versionString[] = "0.8.4-dev";
@ -182,7 +182,6 @@ char blynkApiKey[36] = ""; //Auth token for Blynk server. If
uint16_t realtimeTimeoutMs = 2500; //ms timeout of realtime mode before returning to normal mode
int arlsOffset = 0; //realtime LED offset
bool receiveDirect = true; //receive UDP realtime
bool enableRealtimeUI = false; //web UI accessible during realtime mode (works on ESP32, lags out ESP8266)
bool arlsDisableGammaCorrection = true; //activate if gamma correction is handled by the source
bool arlsForceMaxBri = false; //enable to force max brightness if source has very dark colors that would be black

View File

@ -224,7 +224,7 @@ void saveSettingsToEEPROM()
EEPROM.write(2196, arlsDisableGammaCorrection);
EEPROM.write(2200, !receiveDirect);
EEPROM.write(2201, enableRealtimeUI);
EEPROM.write(2201, notifyMacro); //was enableRealtime
EEPROM.write(2202, uiConfiguration);
EEPROM.write(2203, autoRGBtoRGBW);
EEPROM.write(2204, skipFirstLed);
@ -469,7 +469,7 @@ void loadSettingsFromEEPROM(bool first)
}
receiveDirect = !EEPROM.read(2200);
enableRealtimeUI = EEPROM.read(2201);
notifyMacro = EEPROM.read(2201);
uiConfiguration = EEPROM.read(2202);
#ifdef WLED_DISABLE_MOBILE_UI

View File

@ -56,7 +56,26 @@ void XML_response(AsyncWebServerRequest *request, bool includeTheme)
oappend("</md><cy>");
oappendi(presetCyclingEnabled);
oappend("</cy><ds>");
oappend(serverDescription);
if (realtimeActive)
{
String mesg = "Live ";
if (realtimeIP[0] == 0)
{
mesg += "E1.31 mode";
} else {
mesg += "UDP from ";
mesg += realtimeIP[0];
for (int i = 1; i < 4; i++)
{
mesg += ".";
mesg += realtimeIP[i];
}
}
oappend((char*)mesg.c_str());
} else {
oappend(serverDescription);
}
oappend("</ds>");
if (includeTheme)
{
@ -268,6 +287,7 @@ void getSettingsJS(byte subPage)
sappend('c',"SD",notifyDirectDefault);
sappend('c',"SB",notifyButton);
sappend('c',"SH",notifyHue);
sappend('c',"SM",notifyMacro);
sappend('c',"S2",notifyTwice);
sappend('c',"RD",receiveDirect);
sappend('c',"EM",e131Multicast);
@ -276,7 +296,6 @@ void getSettingsJS(byte subPage)
sappend('c',"FB",arlsForceMaxBri);
sappend('c',"RG",arlsDisableGammaCorrection);
sappend('v',"WO",arlsOffset);
sappend('c',"RU",enableRealtimeUI);
sappend('c',"AL",alexaEnabled);
sappends('s',"AI",alexaInvocationName);
sappend('c',"SA",notifyAlexa);

View File

@ -152,6 +152,9 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
notifyDirectDefault = request->hasArg("SD");
notifyDirect = notifyDirectDefault;
notifyButton = request->hasArg("SB");
notifyAlexa = request->hasArg("SA");
notifyHue = request->hasArg("SH");
notifyMacro = request->hasArg("SM");
notifyTwice = request->hasArg("S2");
receiveDirect = request->hasArg("RD");
@ -164,11 +167,9 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
arlsDisableGammaCorrection = request->hasArg("RG");
t = request->arg("WO").toInt();
if (t >= -255 && t <= 255) arlsOffset = t;
enableRealtimeUI = request->hasArg("RU");
alexaEnabled = request->hasArg("AL");
strcpy(alexaInvocationName, request->arg("AI").c_str());
notifyAlexa = request->hasArg("SA");
if (request->hasArg("BK") && !request->arg("BK").equals("Hidden")) {
strcpy(blynkApiKey,request->arg("BK").c_str()); initBlynk(blynkApiKey);
@ -178,7 +179,6 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
strcpy(mqttDeviceTopic, request->arg("MD").c_str());
strcpy(mqttGroupTopic, request->arg("MG").c_str());
notifyHue = request->hasArg("SH");
for (int i=0;i<4;i++){
String a = "H"+String(i);
hueIP[i] = request->arg(a).toInt();

View File

@ -211,27 +211,6 @@ void serveIndexOrWelcome(AsyncWebServerRequest *request)
}
}
void serveRealtimeError(AsyncWebServerRequest *request, bool settings)
{
String mesg = "The ";
mesg += (settings)?"settings":"WLED";
mesg += " UI is not available while receiving real-time data (";
if (realtimeIP[0] == 0)
{
mesg += "E1.31";
} else {
mesg += "UDP from ";
mesg += realtimeIP[0];
for (int i = 1; i < 4; i++)
{
mesg += ".";
mesg += realtimeIP[i];
}
}
mesg += ").";
request->send(200, "text/plain", mesg);
}
void getCSSColors()
{
@ -250,12 +229,6 @@ void getCSSColors()
void serveIndex(AsyncWebServerRequest* request)
{
if (realtimeActive && !enableRealtimeUI) //do not serve while receiving realtime
{
serveRealtimeError(request, false);
return;
}
bool serveMobile = false;
if (uiConfiguration == 0 && request->hasHeader("User-Agent")) serveMobile = checkClientIsMobile(request->getHeader("User-Agent")->value());
else if (uiConfiguration == 2) serveMobile = true;
@ -339,12 +312,6 @@ void serveSettings(AsyncWebServerRequest* request)
else if (url.indexOf("time") > 0) subPage = 5;
else if (url.indexOf("sec") > 0) subPage = 6;
} else subPage = 255; //welcome page
if (realtimeActive && !enableRealtimeUI) //do not serve while receiving realtime
{
serveRealtimeError(request, true);
return;
}
if (subPage == 1 && wifiLock && otaLock)
{