Fix iOS scrolling
Other small adjustments Allow for passwords with * as 1st char
This commit is contained in:
parent
6122a8371a
commit
77d89e7df3
@ -2302,6 +2302,10 @@ uint16_t WS2812FX::mode_glitter()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//values close to 100 produce 5Hz flicker, which looks very candle-y
|
||||||
|
//Inspired by https://github.com/avanhanegem/ArduinoCandleEffectNeoPixel
|
||||||
|
//and https://cpldcpu.wordpress.com/2016/01/05/reverse-engineering-a-real-candle/
|
||||||
|
|
||||||
uint16_t WS2812FX::mode_candle()
|
uint16_t WS2812FX::mode_candle()
|
||||||
{
|
{
|
||||||
if (SEGENV.call == 0) {
|
if (SEGENV.call == 0) {
|
||||||
@ -2329,17 +2333,14 @@ uint16_t WS2812FX::mode_candle()
|
|||||||
uint8_t valrange = SEGMENT.intensity;
|
uint8_t valrange = SEGMENT.intensity;
|
||||||
uint8_t rndval = valrange >> 1;
|
uint8_t rndval = valrange >> 1;
|
||||||
target = random8(rndval) + random8(rndval);
|
target = random8(rndval) + random8(rndval);
|
||||||
if (target < (rndval >> 1)) target += random8(rndval >> 1);
|
if (target < (rndval >> 1)) target = (rndval >> 1) + random8(rndval);
|
||||||
uint8_t offset = (255 - valrange) >> 1;
|
uint8_t offset = (255 - valrange) >> 1;
|
||||||
target += offset;
|
target += offset;
|
||||||
|
|
||||||
uint8_t dif = (target > s) ? target - s : s - target;
|
uint8_t dif = (target > s) ? target - s : s - target;
|
||||||
uint16_t fadeSpeed = 50 + ((255-SEGMENT.speed) >> 1);
|
|
||||||
|
|
||||||
//how much to move closer to target per frame
|
//how much to move closer to target per frame
|
||||||
fadeStep = dif;
|
fadeStep = dif >> 2; //mode called every ~25 ms, so 4 frames to have a new target every 100ms
|
||||||
uint8_t frames = 1;
|
|
||||||
if (fadeSpeed > FRAMETIME) fadeStep = dif / (fadeSpeed / FRAMETIME);
|
|
||||||
if (fadeStep == 0) fadeStep = 1;
|
if (fadeStep == 0) fadeStep = 1;
|
||||||
|
|
||||||
SEGENV.step = fadeStep;
|
SEGENV.step = fadeStep;
|
||||||
|
@ -571,12 +571,12 @@ class WS2812FX {
|
|||||||
const char JSON_mode_names[] PROGMEM = R"=====([
|
const char JSON_mode_names[] PROGMEM = R"=====([
|
||||||
"Solid","Blink","Breathe","Wipe","Wipe Random","Random Colors","Sweep","Dynamic","Colorloop","Rainbow",
|
"Solid","Blink","Breathe","Wipe","Wipe Random","Random Colors","Sweep","Dynamic","Colorloop","Rainbow",
|
||||||
"Scan","Dual Scan","Fade","Theater","Theater Rainbow","Running","Saw","Twinkle","Dissolve","Dissolve Rnd",
|
"Scan","Dual Scan","Fade","Theater","Theater Rainbow","Running","Saw","Twinkle","Dissolve","Dissolve Rnd",
|
||||||
"Sparkle","Dark Sparkle","Sparkle+","Strobe","Strobe Rainbow","Mega Strobe","Blink Rainbow","Android","Chase","Chase Random",
|
"Sparkle","Sparkle Dark","Sparkle+","Strobe","Strobe Rainbow","Strobe Mega","Blink Rainbow","Android","Chase","Chase Random",
|
||||||
"Chase Rainbow","Chase Flash","Chase Flash Rnd","Rainbow Runner","Colorful","Traffic Light","Sweep Random","Running 2","Red & Blue","Stream",
|
"Chase Rainbow","Chase Flash","Chase Flash Rnd","Rainbow Runner","Colorful","Traffic Light","Sweep Random","Running 2","Red & Blue","Stream",
|
||||||
"Scanner","Lighthouse","Fireworks","Rain","Merry Christmas","Fire Flicker","Gradient","Loading","Police","Police All",
|
"Scanner","Lighthouse","Fireworks","Rain","Merry Christmas","Fire Flicker","Gradient","Loading","Police","Police All",
|
||||||
"Two Dots","Two Areas","Circus","Halloween","Tri Chase","Tri Wipe","Tri Fade","Lightning","ICU","Multi Comet",
|
"Two Dots","Two Areas","Circus","Halloween","Tri Chase","Tri Wipe","Tri Fade","Lightning","ICU","Multi Comet",
|
||||||
"Dual Scanner","Stream 2","Oscillate","Pride 2015","Juggle","Palette","Fire 2012","Colorwaves","Bpm","Fill Noise",
|
"Scanner Dual ","Stream 2","Oscillate","Pride 2015","Juggle","Palette","Fire 2012","Colorwaves","Bpm","Fill Noise",
|
||||||
"Noise 1","Noise 2","Noise 3","Noise 4","Colortwinkles","Lake","Meteor","Smooth Meteor","Railway","Ripple",
|
"Noise 1","Noise 2","Noise 3","Noise 4","Colortwinkles","Lake","Meteor","Meteor Smooth","Railway","Ripple",
|
||||||
"Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Solid Pattern Tri","Spots","Spots Fade","Glitter","Candle"
|
"Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Solid Pattern Tri","Spots","Spots Fade","Glitter","Candle"
|
||||||
])=====";
|
])=====";
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -23,16 +23,19 @@
|
|||||||
<script>
|
<script>
|
||||||
update();
|
update();
|
||||||
|
|
||||||
|
var tmout = null;
|
||||||
function update()
|
function update()
|
||||||
{
|
{
|
||||||
if (document.hidden) {
|
if (document.hidden) {
|
||||||
setTimeout(update, 250);
|
clearTimeout(tmout);
|
||||||
|
tmout = setTimeout(update, 250);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fetch('/json/live')
|
fetch('/json/live')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
setTimeout(update, 2500);
|
clearTimeout(tmout);
|
||||||
|
tmout = setTimeout(update, 2500);
|
||||||
}
|
}
|
||||||
return res.json();
|
return res.json();
|
||||||
})
|
})
|
||||||
@ -47,10 +50,12 @@
|
|||||||
}
|
}
|
||||||
str += ")";
|
str += ")";
|
||||||
document.getElementById("canv").style.background = str;
|
document.getElementById("canv").style.background = str;
|
||||||
setTimeout(update, 40);
|
clearTimeout(tmout);
|
||||||
|
tmout = setTimeout(update, 40);
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
setTimeout(update, 2500);
|
clearTimeout(tmout);
|
||||||
|
tmout = setTimeout(update, 2500);
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ const char PAGE_msg[] PROGMEM = R"=====(<!DOCTYPE html>
|
|||||||
const char PAGE_update[] PROGMEM = R"=====(<!DOCTYPE html>
|
const char PAGE_update[] PROGMEM = R"=====(<!DOCTYPE html>
|
||||||
<html><head><meta content='width=device-width' name='viewport'><title>WLED Update</title><script>function B(){window.history.back()}</script>
|
<html><head><meta content='width=device-width' name='viewport'><title>WLED Update</title><script>function B(){window.history.back()}</script>
|
||||||
<style>.bt{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.3ch solid #333;display:inline-block;font-size:20px;margin:8px;margin-top:12px}input[type=file]{font-size:16px}body{font-family:Verdana,sans-serif;text-align:center;background:#222;color:#fff;line-height:200%}</style></head>
|
<style>.bt{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.3ch solid #333;display:inline-block;font-size:20px;margin:8px;margin-top:12px}input[type=file]{font-size:16px}body{font-family:Verdana,sans-serif;text-align:center;background:#222;color:#fff;line-height:200%}</style></head>
|
||||||
<body><h2>WLED Software Update</h2>Installed version: 0.9.0-dev<br>Download the latest binary: <a href="https://github.com/Aircoookie/WLED/releases"><img src="https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square"></a><br><form method='POST' action='/update' enctype='multipart/form-data'><input type='file' class="bt" name='update' required><br><input type='submit' class="bt" value='Update!'></form><button type="button" class="bt" onclick="B()">Back</button></body></html>)=====";
|
<body><h2>WLED Software Update</h2>Installed version: 0.9.0-b1<br>Download the latest binary: <a href="https://github.com/Aircoookie/WLED/releases"><img src="https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square"></a><br><form method='POST' action='/update' enctype='multipart/form-data'><input type='file' class="bt" name='update' required><br><input type='submit' class="bt" value='Update!'></form><button type="button" class="bt" onclick="B()">Back</button></body></html>)=====";
|
||||||
|
|
||||||
|
|
||||||
//new user welcome page
|
//new user welcome page
|
||||||
@ -36,14 +36,50 @@ const char PAGE_liveview[] PROGMEM = R"=====(<!DOCTYPE html>
|
|||||||
<meta charset=utf-8>
|
<meta charset=utf-8>
|
||||||
<meta name=theme-color content=#222222>
|
<meta name=theme-color content=#222222>
|
||||||
<title>WLED Live Preview</title>
|
<title>WLED Live Preview</title>
|
||||||
<style>body{margin:0}#canv{background:black;filter:brightness(175%);width:100%;height:100%;position:absolute}</style>
|
<style>
|
||||||
</head>
|
body {margin: 0;}
|
||||||
<body><div id=canv />
|
#canv {background: black;filter: brightness(175%);width: 100%;height: 100%;position: absolute;}
|
||||||
<script>update();function update()
|
</style></head>
|
||||||
{if(document.hidden){setTimeout(update,250);return;}
|
<body>
|
||||||
fetch('/json/live').then(res=>{if(!res.ok){setTimeout(update,2500);}
|
<div id="canv" />
|
||||||
return res.json();}).then(json=>{var str="linear-gradient(90deg,";var len=json.leds.length;for(i=0;i<len;i++){var leddata=json.leds[i];if(leddata.length>6)leddata=leddata.substring(2);str+="#"+leddata;if(i<len-1)str+=","}
|
<script>
|
||||||
str+=")";document.getElementById("canv").style.background=str;setTimeout(update,40);}).catch(function(error){setTimeout(update,2500);})}</script>
|
update();
|
||||||
|
var tmout = null;
|
||||||
|
function update()
|
||||||
|
{
|
||||||
|
if (document.hidden) {
|
||||||
|
clearTimeout(tmout);
|
||||||
|
tmout = setTimeout(update, 250);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fetch('/json/live')
|
||||||
|
.then(res => {
|
||||||
|
if (!res.ok) {
|
||||||
|
clearTimeout(tmout);
|
||||||
|
tmout = setTimeout(update, 2500);
|
||||||
|
}
|
||||||
|
return res.json();
|
||||||
|
})
|
||||||
|
.then(json => {
|
||||||
|
var str = "linear-gradient(90deg,";
|
||||||
|
var len = json.leds.length;
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
var leddata = json.leds[i];
|
||||||
|
if (leddata.length > 6) leddata = leddata.substring(2);
|
||||||
|
str += "#" + leddata;
|
||||||
|
if (i < len -1) str += ","
|
||||||
|
}
|
||||||
|
str += ")";
|
||||||
|
document.getElementById("canv").style.background = str;
|
||||||
|
clearTimeout(tmout);
|
||||||
|
tmout = setTimeout(update, 40);
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
clearTimeout(tmout);
|
||||||
|
tmout = setTimeout(update, 2500);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body></html>)=====";
|
</body></html>)=====";
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ Color order:
|
|||||||
<select name=CO>
|
<select name=CO>
|
||||||
<option value=0>GRB</option>
|
<option value=0>GRB</option>
|
||||||
<option value=1>RGB</option>
|
<option value=1>RGB</option>
|
||||||
<option value=2 disabled>BRG</option>
|
<option value=2>BRG</option>
|
||||||
<option value=3>RBG</option>
|
<option value=3>RBG</option>
|
||||||
</select>
|
</select>
|
||||||
<h3>Defaults</h3>
|
<h3>Defaults</h3>
|
||||||
@ -287,7 +287,7 @@ Clock Overlay:
|
|||||||
<select name="OL" onchange="Cs()">
|
<select name="OL" onchange="Cs()">
|
||||||
<option value="0" id="cn" selected>None</option>
|
<option value="0" id="cn" selected>None</option>
|
||||||
<option value="1" id="ca">Analog Clock</option>
|
<option value="1" id="ca">Analog Clock</option>
|
||||||
<option value="2">Single Digit Clock</option>
|
<option value="2" disabled>-</option>
|
||||||
<option value="3" id="cc">Cronixie Clock</option>
|
<option value="3" id="cc">Cronixie Clock</option>
|
||||||
</select><br>
|
</select><br>
|
||||||
<div id="coc">
|
<div id="coc">
|
||||||
@ -365,7 +365,7 @@ HTTP traffic is unencrypted. An attacker in the same network can intercept form
|
|||||||
<button type="button" onclick="U()">Manual OTA Update</button><br>
|
<button type="button" onclick="U()">Manual OTA Update</button><br>
|
||||||
Enable ArduinoOTA: <input type="checkbox" name="AO"><br>
|
Enable ArduinoOTA: <input type="checkbox" name="AO"><br>
|
||||||
<h3>About</h3>
|
<h3>About</h3>
|
||||||
<a href="https://github.com/Aircoookie/WLED" target="_blank">WLED</a> version 0.9.0-dev<br><br>
|
<a href="https://github.com/Aircoookie/WLED" target="_blank">WLED</a> version 0.9.0-b1<br><br>
|
||||||
<a href="https://github.com/Aircoookie/WLED/wiki/Contributors-&-About" target="_blank">Contributors, dependencies and special thanks</a><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>
|
A huge thank you to everyone who helped me create WLED!<br><br>
|
||||||
(c) 2016-2019 Christian Schwinne <br>
|
(c) 2016-2019 Christian Schwinne <br>
|
||||||
|
2900
wled00/html_ui.h
2900
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* @title WLED project sketch
|
* @title WLED project sketch
|
||||||
* @version 0.9.0-dev
|
* @version 0.9.0-b1
|
||||||
* @author Christian Schwinne
|
* @author Christian Schwinne
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -14,15 +14,16 @@
|
|||||||
//Uncomment some of the following lines to disable features to compile for ESP8266-01 (max flash size 434kB):
|
//Uncomment some of the following lines to disable features to compile for ESP8266-01 (max flash size 434kB):
|
||||||
|
|
||||||
//You are required to disable over-the-air updates:
|
//You are required to disable over-the-air updates:
|
||||||
//#define WLED_DISABLE_OTA
|
//#define WLED_DISABLE_OTA //saves 14kb
|
||||||
|
|
||||||
//You need to choose some of these features to disable:
|
//You need to choose some of these features to disable:
|
||||||
//#define WLED_DISABLE_ALEXA
|
//#define WLED_DISABLE_ALEXA //saves 11kb
|
||||||
//#define WLED_DISABLE_BLYNK
|
//#define WLED_DISABLE_BLYNK //saves 6kb
|
||||||
//#define WLED_DISABLE_CRONIXIE
|
//#define WLED_DISABLE_CRONIXIE //saves 3kb
|
||||||
//#define WLED_DISABLE_HUESYNC
|
//#define WLED_DISABLE_HUESYNC //saves 4kb
|
||||||
//#define WLED_DISABLE_INFRARED //there is no pin left for this on ESP8266-01
|
//#define WLED_DISABLE_INFRARED //there is no pin left for this on ESP8266-01, saves 25kb (!)
|
||||||
#define WLED_ENABLE_ADALIGHT //only saves about 500b
|
#define WLED_ENABLE_MQTT //saves 12kb
|
||||||
|
#define WLED_ENABLE_ADALIGHT //saves 500b only
|
||||||
|
|
||||||
#define WLED_DISABLE_FILESYSTEM //SPIFFS is not used by any WLED feature yet
|
#define WLED_DISABLE_FILESYSTEM //SPIFFS is not used by any WLED feature yet
|
||||||
//#define WLED_ENABLE_FS_SERVING //Enable sending html file from SPIFFS before serving progmem version
|
//#define WLED_ENABLE_FS_SERVING //Enable sending html file from SPIFFS before serving progmem version
|
||||||
@ -97,8 +98,8 @@
|
|||||||
|
|
||||||
|
|
||||||
//version code in format yymmddb (b = daily build)
|
//version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 1912061
|
#define VERSION 1912111
|
||||||
char versionString[] = "0.9.0-dev";
|
char versionString[] = "0.9.0-b1";
|
||||||
|
|
||||||
|
|
||||||
//AP and OTA default passwords (for maximum change them!)
|
//AP and OTA default passwords (for maximum change them!)
|
||||||
@ -328,11 +329,6 @@ byte overlayCurrent = overlayDefault;
|
|||||||
byte overlaySpeed = 200;
|
byte overlaySpeed = 200;
|
||||||
unsigned long overlayRefreshMs = 200;
|
unsigned long overlayRefreshMs = 200;
|
||||||
unsigned long overlayRefreshedTime;
|
unsigned long overlayRefreshedTime;
|
||||||
int overlayArr[6];
|
|
||||||
uint16_t overlayDur[6];
|
|
||||||
uint16_t overlayPauseDur[6];
|
|
||||||
int nixieClockI = -1;
|
|
||||||
bool nixiePause = false;
|
|
||||||
|
|
||||||
//cronixie
|
//cronixie
|
||||||
byte dP[]{0,0,0,0,0,0};
|
byte dP[]{0,0,0,0,0,0};
|
||||||
@ -482,7 +478,7 @@ void reset()
|
|||||||
|
|
||||||
|
|
||||||
//append new c string to temp buffer efficiently
|
//append new c string to temp buffer efficiently
|
||||||
bool oappend(char* txt)
|
bool oappend(const char* txt)
|
||||||
{
|
{
|
||||||
uint16_t len = strlen(txt);
|
uint16_t len = strlen(txt);
|
||||||
if (olen + len >= OMAX) return false; //buffer full
|
if (olen + len >= OMAX) return false; //buffer full
|
||||||
|
@ -495,6 +495,7 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
//1024-2047 reserved
|
//1024-2047 reserved
|
||||||
|
|
||||||
readStringFromEEPROM(2220, blynkApiKey, 35);
|
readStringFromEEPROM(2220, blynkApiKey, 35);
|
||||||
|
if (strlen(blynkApiKey) < 25) blynkApiKey[0] = 0;
|
||||||
|
|
||||||
//user MOD memory
|
//user MOD memory
|
||||||
//2944 - 3071 reserved
|
//2944 - 3071 reserved
|
||||||
|
@ -82,7 +82,7 @@ char* XML_response(AsyncWebServerRequest *request, char* dest = nullptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//append a numeric setting to string buffer
|
//append a numeric setting to string buffer
|
||||||
void sappend(char stype, char* key, int val)
|
void sappend(char stype, const char* key, int val)
|
||||||
{
|
{
|
||||||
char ds[] = "d.Sf.";
|
char ds[] = "d.Sf.";
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ void sappend(char stype, char* key, int val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//append a string setting to buffer
|
//append a string setting to buffer
|
||||||
void sappends(char stype, char* key, char* val)
|
void sappends(char stype, const char* key, char* val)
|
||||||
{
|
{
|
||||||
switch(stype)
|
switch(stype)
|
||||||
{
|
{
|
||||||
@ -269,6 +269,8 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
sappends('s',"AI",alexaInvocationName);
|
sappends('s',"AI",alexaInvocationName);
|
||||||
sappend('c',"SA",notifyAlexa);
|
sappend('c',"SA",notifyAlexa);
|
||||||
sappends('s',"BK",(char*)((blynkEnabled)?"Hidden":""));
|
sappends('s',"BK",(char*)((blynkEnabled)?"Hidden":""));
|
||||||
|
|
||||||
|
#ifdef WLED_ENABLE_MQTT
|
||||||
sappends('s',"MS",mqttServer);
|
sappends('s',"MS",mqttServer);
|
||||||
sappend('v',"MQPORT",mqttPort);
|
sappend('v',"MQPORT",mqttPort);
|
||||||
sappends('s',"MQUSER",mqttUser);
|
sappends('s',"MQUSER",mqttUser);
|
||||||
@ -281,6 +283,11 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
sappends('s',"MQCID",mqttClientID);
|
sappends('s',"MQCID",mqttClientID);
|
||||||
sappends('s',"MD",mqttDeviceTopic);
|
sappends('s',"MD",mqttDeviceTopic);
|
||||||
sappends('s',"MG",mqttGroupTopic);
|
sappends('s',"MG",mqttGroupTopic);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WLED_DISABLE_HUESYNC
|
||||||
|
sappends('m',"(\"hms\")[0]","Unsupported in build");
|
||||||
|
#else
|
||||||
sappend('v',"H0",hueIP[0]);
|
sappend('v',"H0",hueIP[0]);
|
||||||
sappend('v',"H1",hueIP[1]);
|
sappend('v',"H1",hueIP[1]);
|
||||||
sappend('v',"H2",hueIP[2]);
|
sappend('v',"H2",hueIP[2]);
|
||||||
@ -292,6 +299,7 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
sappend('c',"HB",hueApplyBri);
|
sappend('c',"HB",hueApplyBri);
|
||||||
sappend('c',"HC",hueApplyColor);
|
sappend('c',"HC",hueApplyColor);
|
||||||
sappends('m',"(\"hms\")[0]",hueError);
|
sappends('m',"(\"hms\")[0]",hueError);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subPage == 5)
|
if (subPage == 5)
|
||||||
|
@ -14,6 +14,16 @@ void _setRandomColor(bool _sec,bool fromButton=false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isAsterisksOnly(const char* str, byte maxLen)
|
||||||
|
{
|
||||||
|
for (byte i = 0; i < maxLen; i++) {
|
||||||
|
if (str[i] == 0) break;
|
||||||
|
if (str[i] != '*') return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//called upon POST settings form submit
|
//called upon POST settings form submit
|
||||||
void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||||
{
|
{
|
||||||
@ -24,7 +34,8 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
if (subPage == 1)
|
if (subPage == 1)
|
||||||
{
|
{
|
||||||
strlcpy(clientSSID,request->arg("CS").c_str(), 33);
|
strlcpy(clientSSID,request->arg("CS").c_str(), 33);
|
||||||
if (request->arg("CP").charAt(0) != '*') strlcpy(clientPass, request->arg("CP").c_str(), 65);
|
|
||||||
|
if (!isAsterisksOnly(request->arg("CP").c_str(), 65)) strlcpy(clientPass, request->arg("CP").c_str(), 65);
|
||||||
|
|
||||||
strlcpy(cmDNS, request->arg("CM").c_str(), 33);
|
strlcpy(cmDNS, request->arg("CM").c_str(), 33);
|
||||||
|
|
||||||
@ -32,7 +43,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
strlcpy(apSSID, request->arg("AS").c_str(), 33);
|
strlcpy(apSSID, request->arg("AS").c_str(), 33);
|
||||||
apHide = request->hasArg("AH");
|
apHide = request->hasArg("AH");
|
||||||
int passlen = request->arg("AP").length();
|
int passlen = request->arg("AP").length();
|
||||||
if (passlen == 0 || (passlen > 7 && request->arg("AP").charAt(0) != '*')) strlcpy(apPass, request->arg("AP").c_str(), 65);
|
if (passlen == 0 || (passlen > 7 && !isAsterisksOnly(request->arg("AP").c_str(), 65))) strlcpy(apPass, request->arg("AP").c_str(), 65);
|
||||||
int t = request->arg("AC").toInt(); if (t > 0 && t < 14) apChannel = t;
|
int t = request->arg("AC").toInt(); if (t > 0 && t < 14) apChannel = t;
|
||||||
|
|
||||||
char k[3]; k[2] = 0;
|
char k[3]; k[2] = 0;
|
||||||
@ -141,15 +152,18 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
strlcpy(blynkApiKey, request->arg("BK").c_str(), 36); initBlynk(blynkApiKey);
|
strlcpy(blynkApiKey, request->arg("BK").c_str(), 36); initBlynk(blynkApiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WLED_ENABLE_MQTT
|
||||||
strlcpy(mqttServer, request->arg("MS").c_str(), 33);
|
strlcpy(mqttServer, request->arg("MS").c_str(), 33);
|
||||||
t = request->arg("MQPORT").toInt();
|
t = request->arg("MQPORT").toInt();
|
||||||
if (t > 0) mqttPort = t;
|
if (t > 0) mqttPort = t;
|
||||||
strlcpy(mqttUser, request->arg("MQUSER").c_str(), 41);
|
strlcpy(mqttUser, request->arg("MQUSER").c_str(), 41);
|
||||||
if (request->arg("MQPASS").charAt(0) != '*') strlcpy(mqttPass, request->arg("MQPASS").c_str(), 41);
|
if (!isAsterisksOnly(request->arg("MQPASS").c_str(), 41)) strlcpy(mqttPass, request->arg("MQPASS").c_str(), 41);
|
||||||
strlcpy(mqttClientID, request->arg("MQCID").c_str(), 41);
|
strlcpy(mqttClientID, request->arg("MQCID").c_str(), 41);
|
||||||
strlcpy(mqttDeviceTopic, request->arg("MD").c_str(), 33);
|
strlcpy(mqttDeviceTopic, request->arg("MD").c_str(), 33);
|
||||||
strlcpy(mqttGroupTopic, request->arg("MG").c_str(), 33);
|
strlcpy(mqttGroupTopic, request->arg("MG").c_str(), 33);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WLED_DISABLE_HUESYNC
|
||||||
for (int i=0;i<4;i++){
|
for (int i=0;i<4;i++){
|
||||||
String a = "H"+String(i);
|
String a = "H"+String(i);
|
||||||
hueIP[i] = request->arg(a).toInt();
|
hueIP[i] = request->arg(a).toInt();
|
||||||
@ -167,6 +181,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
huePollingEnabled = request->hasArg("HP");
|
huePollingEnabled = request->hasArg("HP");
|
||||||
hueStoreAllowed = true;
|
hueStoreAllowed = true;
|
||||||
reconnectHue();
|
reconnectHue();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//TIME
|
//TIME
|
||||||
|
@ -140,7 +140,10 @@ void initAP(bool resetAP=false){
|
|||||||
if (udpPort > 0 && udpPort != ntpLocalPort)
|
if (udpPort > 0 && udpPort != ntpLocalPort)
|
||||||
{
|
{
|
||||||
udpConnected = notifierUdp.begin(udpPort);
|
udpConnected = notifierUdp.begin(udpPort);
|
||||||
if (udpConnected && udpRgbPort != udpPort) udpRgbConnected = rgbUdp.begin(udpRgbPort);
|
}
|
||||||
|
if (udpRgbPort > 0 && udpRgbPort != ntpLocalPort && udpRgbPort != udpPort)
|
||||||
|
{
|
||||||
|
udpRgbConnected = rgbUdp.begin(udpRgbPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
|
dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
|
||||||
|
@ -120,7 +120,6 @@ void handleNotifications()
|
|||||||
{
|
{
|
||||||
e131NewData = false;
|
e131NewData = false;
|
||||||
strip.show();
|
strip.show();
|
||||||
Serial.println("Show");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//unlock strip when realtime UDP times out
|
//unlock strip when realtime UDP times out
|
||||||
|
@ -17,107 +17,6 @@ void initCronixie()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void _nixieDisplay(int num[], uint16_t dur[], uint16_t pausedur[], byte cnt)
|
|
||||||
{
|
|
||||||
strip.setRange(overlayMin, overlayMax, 0);
|
|
||||||
if (num[nixieClockI] >= 0 && !nixiePause)
|
|
||||||
{
|
|
||||||
strip.setIndividual(num[nixieClockI],((uint32_t)colT[3] << 24)| ((uint32_t)colT[0] << 16) | ((uint32_t)colT[1] << 8) | colT[2]);
|
|
||||||
strip.unlock(num[nixieClockI]);
|
|
||||||
}
|
|
||||||
if (!nixiePause)
|
|
||||||
{
|
|
||||||
overlayRefreshMs = dur[nixieClockI];
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
overlayRefreshMs = pausedur[nixieClockI];
|
|
||||||
}
|
|
||||||
if (pausedur[nixieClockI] > 0 && !nixiePause)
|
|
||||||
{
|
|
||||||
nixiePause = true;
|
|
||||||
} else {
|
|
||||||
if (nixieClockI < cnt -1)
|
|
||||||
{
|
|
||||||
nixieClockI++;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
nixieClockI = -1;
|
|
||||||
}
|
|
||||||
nixiePause = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _nixieNumber(int number, int dur)
|
|
||||||
{
|
|
||||||
if (nixieClockI < 0)
|
|
||||||
{
|
|
||||||
DEBUG_PRINT(number);
|
|
||||||
int digitCnt = -1;
|
|
||||||
int digits[4];
|
|
||||||
digits[3] = number/1000;
|
|
||||||
digits[2] = (number/100)%10;
|
|
||||||
digits[1] = (number/10)%10;
|
|
||||||
digits[0] = number%10;
|
|
||||||
if (number > 999) //four digits
|
|
||||||
{
|
|
||||||
digitCnt = 4;
|
|
||||||
} else if (number > 99) //three digits
|
|
||||||
{
|
|
||||||
digitCnt = 3;
|
|
||||||
} else if (number > 9) //two digits
|
|
||||||
{
|
|
||||||
digitCnt = 2;
|
|
||||||
} else { //single digit
|
|
||||||
digitCnt = 1;
|
|
||||||
}
|
|
||||||
DEBUG_PRINT(" ");
|
|
||||||
for (int i = 0; i < digitCnt; i++)
|
|
||||||
{
|
|
||||||
DEBUG_PRINT(digits[i]);
|
|
||||||
overlayArr[digitCnt-1-i] = digits[i];
|
|
||||||
overlayDur[digitCnt-1-i] = ((dur/4)*3)/digitCnt;
|
|
||||||
overlayPauseDur[digitCnt-1-i] = 0;
|
|
||||||
}
|
|
||||||
DEBUG_PRINTLN(" ");
|
|
||||||
for (int i = 1; i < digitCnt; i++)
|
|
||||||
{
|
|
||||||
if (overlayArr[i] == overlayArr[i-1])
|
|
||||||
{
|
|
||||||
overlayPauseDur[i-1] = dur/12;
|
|
||||||
overlayDur[i-1] = overlayDur[i-1]-dur/12;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = digitCnt; i < 6; i++)
|
|
||||||
{
|
|
||||||
overlayArr[i] = -1;
|
|
||||||
overlayDur[i] = 0;
|
|
||||||
overlayPauseDur[i] = 0;
|
|
||||||
}
|
|
||||||
overlayPauseDur[5] = dur/4;
|
|
||||||
for (int i = 0; i < 6; i++)
|
|
||||||
{
|
|
||||||
if (overlayArr[i] != -1)
|
|
||||||
{
|
|
||||||
overlayArr[i] = overlayArr[i] + overlayMin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = 0; i <6; i++)
|
|
||||||
{
|
|
||||||
DEBUG_PRINT(overlayArr[i]);
|
|
||||||
DEBUG_PRINT(" ");
|
|
||||||
DEBUG_PRINT(overlayDur[i]);
|
|
||||||
DEBUG_PRINT(" ");
|
|
||||||
DEBUG_PRINT(overlayPauseDur[i]);
|
|
||||||
DEBUG_PRINT(" ");
|
|
||||||
}
|
|
||||||
DEBUG_PRINTLN(" ");
|
|
||||||
nixieClockI = 0;
|
|
||||||
} else {
|
|
||||||
_nixieDisplay(overlayArr, overlayDur, overlayPauseDur, 6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void handleOverlays()
|
void handleOverlays()
|
||||||
{
|
{
|
||||||
if (millis() - overlayRefreshedTime > overlayRefreshMs)
|
if (millis() - overlayRefreshedTime > overlayRefreshMs)
|
||||||
@ -129,14 +28,15 @@ void handleOverlays()
|
|||||||
{
|
{
|
||||||
case 0: break;//no overlay
|
case 0: break;//no overlay
|
||||||
case 1: _overlayAnalogClock(); break;//2 analog clock
|
case 1: _overlayAnalogClock(); break;//2 analog clock
|
||||||
case 2: _overlayNixieClock(); break;//nixie 1-digit
|
case 2: break;//nixie 1-digit, removed
|
||||||
case 3: _overlayCronixie();//Diamex cronixie clock kit
|
case 3: _overlayCronixie();//Diamex cronixie clock kit
|
||||||
}
|
}
|
||||||
if (!countdownMode || overlayCurrent < 2) checkCountdown(); //countdown macro activation must work
|
if (!countdownMode || overlayCurrent < 3) checkCountdown(); //countdown macro activation must work
|
||||||
overlayRefreshedTime = millis();
|
overlayRefreshedTime = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void _overlayAnalogClock()
|
void _overlayAnalogClock()
|
||||||
{
|
{
|
||||||
int overlaySize = overlayMax - overlayMin +1;
|
int overlaySize = overlayMax - overlayMin +1;
|
||||||
@ -182,98 +82,6 @@ void _overlayAnalogClock()
|
|||||||
overlayRefreshMs = 998;
|
overlayRefreshMs = 998;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _overlayNixieClock()
|
|
||||||
{
|
|
||||||
#ifdef WLED_DISABLE_CRONIXIE
|
|
||||||
if (countdownMode) checkCountdown();
|
|
||||||
#else
|
|
||||||
|
|
||||||
if (countdownMode)
|
|
||||||
{
|
|
||||||
_overlayNixieCountdown(); return;
|
|
||||||
}
|
|
||||||
if (nixieClockI < 0)
|
|
||||||
{
|
|
||||||
overlayArr[0] = hour(local);
|
|
||||||
if (useAMPM) overlayArr[0] = overlayArr[0]%12;
|
|
||||||
overlayArr[1] = -1;
|
|
||||||
if (overlayArr[0] > 9)
|
|
||||||
{
|
|
||||||
overlayArr[1] = overlayArr[0]%10;
|
|
||||||
overlayArr[0] = overlayArr[0]/10;
|
|
||||||
}
|
|
||||||
overlayArr[2] = minute(local);
|
|
||||||
overlayArr[3] = overlayArr[2]%10;
|
|
||||||
overlayArr[2] = overlayArr[2]/10;
|
|
||||||
overlayArr[4] = -1;
|
|
||||||
overlayArr[5] = -1;
|
|
||||||
if (analogClockSecondsTrail)
|
|
||||||
{
|
|
||||||
overlayArr[4] = second(local);
|
|
||||||
overlayArr[5] = overlayArr[4]%10;
|
|
||||||
overlayArr[4] = overlayArr[4]/10;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < 6; i++)
|
|
||||||
{
|
|
||||||
if (overlayArr[i] != -1)
|
|
||||||
{
|
|
||||||
overlayArr[i] = overlayArr[i] + overlayMin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
overlayDur[0] = 12 + 12*(255 - overlaySpeed);
|
|
||||||
if (overlayArr[1] == overlayArr[0])
|
|
||||||
{
|
|
||||||
overlayPauseDur[0] = 3 + 3*(255 - overlaySpeed);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
overlayPauseDur[0] = 0;
|
|
||||||
}
|
|
||||||
if (overlayArr[1] == -1)
|
|
||||||
{
|
|
||||||
overlayDur[1] = 0;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
overlayDur[1] = 12 + 12*(255 - overlaySpeed);
|
|
||||||
}
|
|
||||||
overlayPauseDur[1] = 9 + 9*(255 - overlaySpeed);
|
|
||||||
|
|
||||||
overlayDur[2] = 12 + 12*(255 - overlaySpeed);
|
|
||||||
if (overlayArr[2] == overlayArr[3])
|
|
||||||
{
|
|
||||||
overlayPauseDur[2] = 3 + 3*(255 - overlaySpeed);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
overlayPauseDur[2] = 0;
|
|
||||||
}
|
|
||||||
overlayDur[3] = 12 + 12*(255 - overlaySpeed);
|
|
||||||
overlayPauseDur[3] = 9 + 9*(255 - overlaySpeed);
|
|
||||||
|
|
||||||
if (overlayArr[4] == -1)
|
|
||||||
{
|
|
||||||
overlayDur[4] = 0;
|
|
||||||
overlayPauseDur[4] = 0;
|
|
||||||
overlayDur[5] = 0;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
overlayDur[4] = 12 + 12*(255 - overlaySpeed);
|
|
||||||
if (overlayArr[5] == overlayArr[4])
|
|
||||||
{
|
|
||||||
overlayPauseDur[4] = 3 + 3*(255 - overlaySpeed);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
overlayPauseDur[4] = 0;
|
|
||||||
}
|
|
||||||
overlayDur[5] = 12 + 12*(255 - overlaySpeed);
|
|
||||||
}
|
|
||||||
overlayPauseDur[5] = 22 + 22*(255 - overlaySpeed);
|
|
||||||
|
|
||||||
nixieClockI = 0;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
_nixieDisplay(overlayArr, overlayDur, overlayPauseDur, 6);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void _overlayAnalogCountdown()
|
void _overlayAnalogCountdown()
|
||||||
{
|
{
|
||||||
@ -319,33 +127,3 @@ void _overlayAnalogCountdown()
|
|||||||
}
|
}
|
||||||
overlayRefreshMs = 998;
|
overlayRefreshMs = 998;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void _overlayNixieCountdown()
|
|
||||||
{
|
|
||||||
if (now() >= countdownTime)
|
|
||||||
{
|
|
||||||
if (checkCountdown())
|
|
||||||
{
|
|
||||||
_nixieNumber(2019, 2019);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
long diff = countdownTime - now();
|
|
||||||
if (diff > 86313600L) //display in years if more than 999 days
|
|
||||||
{
|
|
||||||
diff = diff/31557600L;
|
|
||||||
} else if (diff > 3596400) //display in days if more than 999 hours
|
|
||||||
{
|
|
||||||
diff = diff/86400;
|
|
||||||
} else if (diff > 59940) //display in hours if more than 999 minutes
|
|
||||||
{
|
|
||||||
diff = diff/1440;
|
|
||||||
} else if (diff > 999) //display in minutes if more than 999 seconds
|
|
||||||
{
|
|
||||||
diff = diff/60;
|
|
||||||
}
|
|
||||||
_nixieNumber(diff, 800);
|
|
||||||
}
|
|
||||||
overlayRefreshMs = 998;
|
|
||||||
}
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
* MQTT communication protocol for home automation
|
* MQTT communication protocol for home automation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef WLED_ENABLE_MQTT
|
||||||
|
|
||||||
void parseMQTTBriPayload(char* payload)
|
void parseMQTTBriPayload(char* payload)
|
||||||
{
|
{
|
||||||
if (strstr(payload, "ON") || strstr(payload, "on") || strstr(payload, "true")) {bri = briLast; colorUpdated(1);}
|
if (strstr(payload, "ON") || strstr(payload, "on") || strstr(payload, "true")) {bri = briLast; colorUpdated(1);}
|
||||||
@ -130,3 +132,8 @@ bool initMqtt()
|
|||||||
mqtt->connect();
|
mqtt->connect();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
bool initMqtt(){return false;}
|
||||||
|
void publishMqtt(){}
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user