Added support for default secondary color saving

Started big rework with seperated settings page, new page design, themes, effect intensity, hue sync...
This commit is contained in:
cschwinne 2018-01-27 23:28:20 +01:00
parent f3e03fc435
commit 30ee42732e
24 changed files with 632 additions and 851 deletions

View File

@ -101,6 +101,10 @@ void WS2812FX::decreaseSpeed(uint8_t s) {
setSpeed(s); setSpeed(s);
} }
void WS2812FX::setIntensity(uint8_t in) {
_intensity=in;
}
void WS2812FX::setColor(uint8_t r, uint8_t g, uint8_t b) { void WS2812FX::setColor(uint8_t r, uint8_t g, uint8_t b) {
setColor(((uint32_t)r << 16) | ((uint32_t)g << 8) | b); setColor(((uint32_t)r << 16) | ((uint32_t)g << 8) | b);
} }

View File

@ -235,6 +235,7 @@ class WS2812FX : public NeoPixelBrightnessBus<PIXELFEATURE, PIXELMETHOD> {
setCCFS(bool fs), setCCFS(bool fs),
setCCFE(bool fe), setCCFE(bool fe),
setSpeed(uint8_t s), setSpeed(uint8_t s),
setIntensity(uint8_t in),
increaseSpeed(uint8_t s), increaseSpeed(uint8_t s),
decreaseSpeed(uint8_t s), decreaseSpeed(uint8_t s),
setColor(uint8_t r, uint8_t g, uint8_t b), setColor(uint8_t r, uint8_t g, uint8_t b),
@ -272,6 +273,7 @@ class WS2812FX : public NeoPixelBrightnessBus<PIXELFEATURE, PIXELMETHOD> {
get_random_wheel_index(uint8_t), get_random_wheel_index(uint8_t),
getMode(void), getMode(void),
getSpeed(void), getSpeed(void),
getIntensity(void),
getBrightness(void), getBrightness(void),
getModeCount(void); getModeCount(void);
@ -372,6 +374,7 @@ class WS2812FX : public NeoPixelBrightnessBus<PIXELFEATURE, PIXELMETHOD> {
maxval(uint8_t v, uint8_t w), maxval(uint8_t v, uint8_t w),
_mode_index, _mode_index,
_speed, _speed,
_intensity,
_cc_i1, _cc_i1,
_cc_i2, _cc_i2,
_cc_is, _cc_is,

File diff suppressed because one or more lines are too long

View File

@ -1,23 +1,25 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico'/>
<title>WLED 0.5dev</title> <title>WLED 0.5dev</title>
<script> <script>
var d=document; var d=document;
var w=window.getComputedStyle(d.querySelector("html"));
resp=""; resp="";
var nla=false; var nla=false;
var nra=false; var nra=false;
var nsa=false; var nsa=false;
var sto=false; var sto=false;
var hsb=false;
var fxa=false;
var psa=false;
var uwv=false; var uwv=false;
var firstload=true; var firstload=true;
var lastsx = 0; var lastsx = 0;
var nState = 0; var nState = 0;
bCol = "DarkTurquoise"; var cv=0;
dC = "black"; var lm=0;
aC="";
bC="";
dC="";
function gId(s) //abbrev function gId(s) //abbrev
{ {
@ -26,12 +28,12 @@
function Startup() function Startup()
{ {
gId("fxI").addEventListener("keypress", function(event) { var w=window.getComputedStyle(d.querySelector("html"));
if (event.keyCode == 13) { aC = w.getPropertyValue("--aCol");
event.preventDefault(); bC = w.getPropertyValue("--bCol");
GetFX(); cC = w.getPropertyValue("--cCol");
} dC = w.getPropertyValue("--dCol");
}); CV(0);
setInterval('GIO()', 5000); setInterval('GIO()', 5000);
GIO(); GIO();
} }
@ -50,19 +52,18 @@
d.Cf.SB.value = this.responseXML.getElementsByTagName('cl')[2].childNodes[0].nodeValue; d.Cf.SB.value = this.responseXML.getElementsByTagName('cl')[2].childNodes[0].nodeValue;
if (this.responseXML.getElementsByTagName('wv')[0].childNodes[0].nodeValue >= 0) { if (this.responseXML.getElementsByTagName('wv')[0].childNodes[0].nodeValue >= 0) {
d.Cf.SW.value = this.responseXML.getElementsByTagName('wv')[0].childNodes[0].nodeValue; d.Cf.SW.value = this.responseXML.getElementsByTagName('wv')[0].childNodes[0].nodeValue;
if (!uwv) gId("slW").style.display="block";
uwv = true; uwv = true;
} else { } else {
gId("slW").style.display="none";
uwv = false; uwv = false;
} }
if (d.activeElement != gId("fxI")) d.Cf.TF.value = this.responseXML.getElementsByTagName('fx')[0].childNodes[0].nodeValue; if (d.activeElement != Cf.TX) Cf.TX.selectedIndex = this.responseXML.getElementsByTagName('fx')[0].childNodes[0].nodeValue;
d.Cf.SX.value = this.responseXML.getElementsByTagName('sx')[0].childNodes[0].nodeValue; d.Cf.SX.value = this.responseXML.getElementsByTagName('sx')[0].childNodes[0].nodeValue;
d.Cf.IX.value = this.responseXML.getElementsByTagName('ix')[0].childNodes[0].nodeValue;
nla = (this.responseXML.getElementsByTagName('nl')[0].innerHTML)!=0?true:false; nla = (this.responseXML.getElementsByTagName('nl')[0].innerHTML)!=0?true:false;
nState = 0; nState = 0;
nState = (this.responseXML.getElementsByTagName('nr')[0].innerHTML)!=0?1:0; nState = (this.responseXML.getElementsByTagName('nr')[0].innerHTML)!=0?1:0;
nState += (this.responseXML.getElementsByTagName('ns')[0].innerHTML)!=0?2:0; nState += (this.responseXML.getElementsByTagName('ns')[0].innerHTML)!=0?2:0;
if(firstload)hsb = (this.responseXML.getElementsByTagName('md')[0].innerHTML)!=0?true:false; if(firstload)CV(this.responseXML.getElementsByTagName('md')[0].childNodes[0].nodeValue);
d.getElementsByClassName("desc")[0].innerHTML = this.responseXML.getElementsByTagName('desc')[0].innerHTML; d.getElementsByClassName("desc")[0].innerHTML = this.responseXML.getElementsByTagName('desc')[0].innerHTML;
UV(); UV();
} }
@ -74,7 +75,7 @@
resp=""; resp="";
firstload=false; firstload=false;
} }
function GetCheck() function GC()
{ {
resp+="&A=" + Cf.SA.value; resp+="&A=" + Cf.SA.value;
resp+="&R=" + Cf.SR.value; resp+="&R=" + Cf.SR.value;
@ -84,37 +85,97 @@
UV(); UV();
GIO(); GIO();
} }
function GetFX() function GX()
{ {
resp+="&FX=" + Cf.TF.value; resp+="&FX=" + Cf.TX.selectedIndex;
resp+="&SX=" + Cf.SX.value; resp+="&SX=" + Cf.SX.value;
resp+="&IX=" + Cf.IX.value;
UV(); UV();
GIO(); GIO();
} }
function GetRGB()
{
var r, g, b, i, f, p, q, t;
var h = d.Cf.SH.value, s = d.Cf.SS.value, v=255;
i = Math.floor(h*6);
f = h * 6-i;
p = v * (1-s);
q = v * (1-f*s);
t = v * (1-(1-f)*s);
switch (i%6) {
case 0: r=v,g=t,b=p;break;
case 1: r=q,g=v,b=p;break;
case 2: r=p,g=v,b=t;break;
case 3: r=p,g=q,b=v;break;
case 4: r=t,g=p,b=v;break;
case 5: r=v,g=p,b=q;
}
d.Cf.SR.value=r;
d.Cf.SG.value=g;
d.Cf.SB.value=b;
GC();
}
function GetCC()
{
resp+="&CP=";
resp+=d.Cf.PF.value;
resp+="&CS=";
resp+=d.Cf.SF.value;
resp+="&CM=";
resp+=d.Cf.HF.value;
resp+=(d.Cf.SC.checked)?"&CF=1":"&CF=0";
resp+=(d.Cf.EC.checked)?"&CE=1":"&CE=0";
GIO();
}
function CV(v)
{
if (sto) CloseSettings();
gId("slA").style.display="none";
gId("srgb").style.display="none";
gId("shs").style.display="none";
gId("slW").style.display="none";
gId("tlX").style.display="none";
gId("tlP").style.display="none";
gId("tlN").style.display="none";
if (v<2){
if (uwv) gId("slW").style.display="block";
gId("slA").style.display="block";
}
switch(v){
case 0: gId("srgb").style.display="block";lm=0;break;
case 1: gId("shs").style.display="block";lm=1;break;
case 2: gId("tlP").style.display="block";break;
case 3: gId("tlX").style.display="block";break;
case 4: gId("tlN").style.display="block";
}
cv=v;
mdb.style.fill=(lm>0)?aC:dC;
}
function rgb2hex(red,green,blue) { function rgb2hex(red,green,blue) {
var rgb = blue | (green << 8) | (red << 16); var rgb = blue | (green << 8) | (red << 16);
return '#' +(0x1000000 +rgb).toString(16).slice(1) return '#' +(0x1000000 +rgb).toString(16).slice(1)
} }
function lingrad(r,g,b) { function lingrad(r,g,b) {
return "linear-gradient(white, "+rgb2hex(r,g,b)+")"; return "linear-gradient("+bC+","+rgb2hex(r,g,b)+")";
} }
function UV() function UV()
{ {
d.body.style.background = lingrad(Cf.SR.value,Cf.SG.value,Cf.SB.value); d.body.style.background = lingrad(Cf.SR.value,Cf.SG.value,Cf.SB.value);
setHS(Cf.SR.value,Cf.SG.value,Cf.SB.value); setHS(Cf.SR.value,Cf.SG.value,Cf.SB.value);
SetHSB(); fxb.style.fill=(d.Cf.TX.selectedIndex>0)?aC:dC;
nlb.style.fill=(nla)?bCol:dC; nlb.style.fill=(nla)?aC:dC;
ntb.style.fill=(nla)?aC:dC;
switch(nState) switch(nState)
{ {
case 0: gId("path1").style.fill = dC; gId("path2").style.fill = dC;break; case 0: gId("path1").style.fill = dC; gId("path2").style.fill = dC;break;
case 1: gId("path1").style.fill = bCol; gId("path2").style.fill = dC;break; case 1: gId("path1").style.fill = aC; gId("path2").style.fill = dC;break;
case 2: gId("path1").style.fill = dC;gId("path2").style.fill = bCol;break; case 2: gId("path1").style.fill = dC;gId("path2").style.fill = aC;break;
case 3: gId("path1").style.fill = bCol; gId("path2").style.fill = bCol; case 3: gId("path1").style.fill = aC; gId("path2").style.fill = aC;
} }
tgb.style.fill=(Cf.SA.value>0)?bCol:dC; tgb.style.fill=(Cf.SA.selectedIndex>0)?aC:dC;
ccX.style.display=(Cf.TF.value>52)?"block":"none"; ccX.style.display=(Cf.TX.selectedIndex>52)?"block":"none";
fof.style.fill=(Cf.TF.value>52)?bCol:dC; fof.style.fill=(Cf.TX.selectedIndex>52)?aC:dC;
fmr.style.fill=(Cf.TF.value<1)?bCol:dC; fmr.style.fill=(Cf.TX.selectedIndex<1)?aC:dC;
} }
function TgT() function TgT()
{ {
@ -129,93 +190,22 @@
UV(); UV();
GIO(); GIO();
} }
function TgFX() function SwFX(s)
{ {
if (psa) var n=Cf.TX.selectedIndex+s;
{ Cf.TX.selectedIndex =n;
psa = false; if (n < 0) Cf.TX.selectedIndex = 0;
SetPS(); if (n > 57) Cf.TX.selectedIndex = 53;
} GX();
fxa = !fxa;
if (sto) CloseSettings();
SetFX();
}
function SwitchFX(s)
{
d.Cf.TF.value = parseInt(d.Cf.TF.value) +s;
if (d.Cf.TF.value < 0) d.Cf.TF.value = 0;
if (d.Cf.TF.value > 57) d.Cf.TF.value = 53;
GetFX();
}
function SetFX()
{
if (fxa) {
fxb.style.fill=bCol;
gId("slA").style.display="none";
gId("slR").style.display="none";
gId("slG").style.display="none";
gId("slB").style.display="none";
gId("slH").style.display="none";
gId("slS").style.display="none";
gId("slW").style.display="none";
gId("slX").style.display="block";
gId("tlX").style.display="block";
gId("tlP").style.display="none";
} else {
fxb.style.fill=dC;
gId("slA").style.display="block";
gId("slX").style.display="none";
gId("tlX").style.display="none";
if (uwv) gId("slW").style.display="block";
SetHSB();
}
}
function SetHSB()
{
if (fxa || psa) return;
if (hsb)
{
gId("slR").style.display="none";
gId("slG").style.display="none";
gId("slB").style.display="none";
gId("slH").style.display="block";
gId("slS").style.display="block";
mdb.style.fill=bCol;
} else {
gId("slR").style.display="block";
gId("slG").style.display="block";
gId("slB").style.display="block";
gId("slH").style.display="none";
gId("slS").style.display="none";
mdb.style.fill=dC;
}
} }
function TgHSB() function TgHSB()
{ {
if (fxa) if (cv<2)
{ {
fxa = false; (cv)?CV(0):CV(1);
SetFX(); }else{
CV(lm);
} }
if (psa)
{
psa = false;
SetPS();
}
if (sto) CloseSettings();
hsb = !hsb;
resp+=((hsb)?"&MD=1":"&MD=0");
SetHSB();
}
function TgPS()
{
psa = !psa;
fxa = true;
SetFX();
fxa = false;
fxb.style.fill=dC;
if (sto) CloseSettings();
SetPS();
} }
function SwitchPS(x) function SwitchPS(x)
{ {
@ -223,23 +213,6 @@
if (d.Cf.FF.value < 0) d.Cf.FF.value = 0; if (d.Cf.FF.value < 0) d.Cf.FF.value = 0;
if (d.Cf.FF.value > 24) d.Cf.FF.value = 24; if (d.Cf.FF.value > 24) d.Cf.FF.value = 24;
} }
function SetPS()
{
if (psa) {
psb.style.fill=bCol;
gId("slX").style.display="none";
gId("tlX").style.display="none";
gId("tlP").style.display="block";
} else {
psb.style.fill=dC;
gId("slA").style.display="block";
gId("slX").style.display="none";
gId("tlX").style.display="none";
gId("tlP").style.display="none";
if (uwv) gId("slW").style.display="block";
SetHSB();
}
}
function PSIO(sv) function PSIO(sv)
{ {
if(sv) if(sv)
@ -261,7 +234,7 @@
function OpenSettings() function OpenSettings()
{ {
sto=true; sto=true;
stb.style.fill=bCol; stb.style.fill=aC;
cdB.style.display="none"; cdB.style.display="none";
stf.style.display="inline"; stf.style.display="inline";
stf.src="/settings"; stf.src="/settings";
@ -273,7 +246,7 @@
cdB.style.display="inline"; cdB.style.display="inline";
stf.style.display="none"; stf.style.display="none";
} }
function TgSettings() function TgS()
{ {
if(sto) if(sto)
{ {
@ -285,7 +258,12 @@
function TgNl() function TgNl()
{ {
nla=!nla; nla=!nla;
resp+=(nla)?"&NL=1":"&NL=0"; if(nla){
resp+="&NL="+d.Cf.SN.value;
resp+="&NT="+d.Cf.ST.value;
}else{
resp+="&NL=0";
}
UV(); UV();
GIO(); GIO();
} }
@ -338,41 +316,7 @@
if (s>0) d.Cf.SH.value=h; if (s>0) d.Cf.SH.value=h;
d.Cf.SS.value=s; d.Cf.SS.value=s;
} }
function GetRGB() function CS(i)
{
var r, g, b, i, f, p, q, t;
var h = d.Cf.SH.value, s = d.Cf.SS.value, v=255;
i = Math.floor(h*6);
f = h * 6-i;
p = v * (1-s);
q = v * (1-f*s);
t = v * (1-(1-f)*s);
switch (i%6) {
case 0: r=v,g=t,b=p;break;
case 1: r=q,g=v,b=p;break;
case 2: r=p,g=v,b=t;break;
case 3: r=p,g=q,b=v;break;
case 4: r=t,g=p,b=v;break;
case 5: r=v,g=p,b=q;
}
d.Cf.SR.value=r;
d.Cf.SG.value=g;
d.Cf.SB.value=b;
GetCheck();
}
function GetCC()
{
resp+="&CP=";
resp+=d.Cf.PF.value;
resp+="&CS=";
resp+=d.Cf.SF.value;
resp+="&CM=";
resp+=d.Cf.HF.value;
resp+=(d.Cf.SC.checked)?"&CF=1":"&CF=0";
resp+=(d.Cf.EC.checked)?"&CE=1":"&CE=0";
GIO();
}
function ColSec(i)
{ {
switch(i) switch(i)
{ {
@ -387,123 +331,127 @@
} }
</script> </script>
<style> <style>
:root {
--aCol: #D9B310;
--bCol: #0B3C5D;
--cCol: #1D2731;
--dCol: #328CC1;
--sCol: #000;
}
.ctrl_box { .ctrl_box {
margin: auto; margin: auto;
width: 80vw; width: 80vw;
background-color: #b9b9b9; background-color: var(--cCol);
position: absolute; position: absolute;
top: 60%; top: 55%;
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
filter: drop-shadow( -5px -5px 5px var(--sCol) );
} }
input[type=number] { .sds {
width: 3em;
}
.sliders {
width: 100%; width: 100%;
height: 12vh; height: 12vh;
margin-top: 2vh; margin-top: 2vh;
} }
.sliderA { .sl {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
margin-top: 2vh;
width: 77vw; width: 77vw;
}
#slA {
margin-top: 0vh;
background: linear-gradient(to right, black, yellow); background: linear-gradient(to right, black, yellow);
} }
.sliderR { #slR {
margin-left: auto;
margin-right: auto;
margin-top: 2vh;
width: 77vw;
background: linear-gradient(to right, black, red); background: linear-gradient(to right, black, red);
} }
.sliderG { #slG {
margin-left: auto;
margin-right: auto;
margin-top: 2vh;
width: 77vw;
background: linear-gradient(to right, black, green); background: linear-gradient(to right, black, green);
} }
.sliderB { #slB {
margin-left: auto;
margin-right: auto;
margin-top: 2vh;
width: 77vw;
background: linear-gradient(to right, black, blue); background: linear-gradient(to right, black, blue);
} }
.sliderW { #slW {
display:none;
margin-left: auto;
margin-right: auto;
margin-top: 2vh;
width: 77vw;
background: linear-gradient(to right, black, white); background: linear-gradient(to right, black, white);
} }
.sliderH { #slH {
display:none;
margin-left: auto;
margin-right: auto;
margin-top: 2vh;
width: 77vw;
background: linear-gradient(to right, red, orange , yellow, green, cyan, blue, violet, red); background: linear-gradient(to right, red, orange , yellow, green, cyan, blue, violet, red);
} }
.sliderS { #slS {
display:none;
margin-left: auto;
margin-right: auto;
margin-top: 2vh;
width: 77vw;
background: linear-gradient(to right, grey, green); background: linear-gradient(to right, grey, green);
} }
.toolsFX { #slN {
display:none; background: linear-gradient(to right, black, turquoise);
}
#slT {
background: linear-gradient(to right, black, yellow);
}
.tools {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
margin-top: 2vh; margin-top: 2vh;
width: 77vw; width: 77vw;
} }
.toolsCC { #slX {
display:none;
}
.toolsPS {
display:none;
margin-left: auto;
margin-right: auto;
margin-top: 2vh;
width: 77vw;
}
.sliderX {
display:none;
margin-left: auto;
margin-right: auto;
margin-top: 2vh;
width: 77vw;
background: linear-gradient(to right, black, white); background: linear-gradient(to right, black, white);
} }
#slI {
background: linear-gradient(to right, black, red);
}
body { body {
font-family: Verdana, Helvetica, sans-serif;
text-align: center; text-align: center;
background: linear-gradient(white, black); background: linear-gradient(var(--bCol),black);
height: 100%; height: 100%;
margin: 0; margin: 0;
background-repeat: no-repeat; background-repeat: no-repeat;
background-attachment: fixed; background-attachment: fixed;
color: var(--dCol);
} }
html { html {
height: 100%; height: 100%;
} }
iframe { iframe {
display:none; display:none;
border:none;
filter: drop-shadow( -5px -5px 5px var(--sCol) );
margin: auto; margin: auto;
width: 80vw; width: 80vw;
height: 50vh; height: 60vh;
position: absolute; position: absolute;
top: 60%; top: 55%;
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
svg { svg {
fill: var(--dCol);
width: 12vw; width: 12vw;
height: 10vmin; height: 10vmin;
filter: drop-shadow( -5px -5px 5px var(--sCol) );
}
input {
filter: drop-shadow( -5px -5px 5px var(--sCol) );
}
button {
background: var(--bCol);
color: var(--dCol);
border: 0.5ch solid var(--bCol);
margin-bottom: 1vh;
filter: drop-shadow( -5px -5px 5px var(--sCol) );
}
select {
background: var(--bCol);
color: var(--dCol);
border: 0.5ch solid var(--bCol);
filter: drop-shadow( -5px -5px 5px var(--sCol) );
}
input[type=number] {
background: var(--bCol);
color: var(--dCol);
border: 0.5ch solid var(--bCol);
width: 3em;
} }
input[type=range] { input[type=range] {
-webkit-appearance: none; -webkit-appearance: none;
@ -516,12 +464,13 @@
width: 100%; width: 100%;
height: 12vh; height: 12vh;
cursor: pointer; cursor: pointer;
background: #DDDDDD; background: var(--bCol);
} }
input[type=range]::-webkit-slider-thumb { input[type=range]::-webkit-slider-thumb {
filter: drop-shadow( -5px -5px 5px var(--sCol) );
height: 10vh; height: 10vh;
width: 10vh; width: 10vh;
background: #ffffff; background: var(--aCol);
cursor: pointer; cursor: pointer;
-webkit-appearance: none; -webkit-appearance: none;
margin-top: 1vh; margin-top: 1vh;
@ -530,12 +479,13 @@
width: 100%; width: 100%;
height: 12vh; height: 12vh;
cursor: pointer; cursor: pointer;
background: #DDDDDD; background: var(--bCol);
} }
input[type=range]::-moz-range-thumb { input[type=range]::-moz-range-thumb {
filter: drop-shadow( -5px -5px 5px var(--sCol) );
height: 10vh; height: 10vh;
width: 10vh; width: 10vh;
background: #ffffff; background: var(--aCol);
cursor: pointer; cursor: pointer;
margin-top: 1vh; margin-top: 1vh;
} }
@ -548,14 +498,14 @@
color: transparent; color: transparent;
} }
input[type=range]::-ms-fill-lower { input[type=range]::-ms-fill-lower {
background: #DDDDDD; background: #var(--bCol);
} }
input[type=range]::-ms-fill-upper { input[type=range]::-ms-fill-upper {
background: #DDDDDD; background: #var(--bCol);
} }
input[type=range]::-ms-thumb { input[type=range]::-ms-thumb {
width: 10vh; width: 10vh;
background: #ffffff; background: var(--aCol);
cursor: pointer; cursor: pointer;
height: 10vh; height: 10vh;
} }
@ -584,52 +534,117 @@
<div id="tbB" class="tool_box"> <div id="tbB" class="tool_box">
<svg id="tgb" onclick="TgT()"><use xlink:href="#lnr-power-switch"></use></svg> <svg id="tgb" onclick="TgT()"><use xlink:href="#lnr-power-switch"></use></svg>
<svg id="mdb" onclick="TgHSB()"><use xlink:href="#lnr-list"></use></svg> <svg id="mdb" onclick="TgHSB()"><use xlink:href="#lnr-list"></use></svg>
<svg id="psb" onclick="TgPS()"><use xlink:href="#lnr-heart"></use></svg> <svg id="psb" onclick="CV(2)"><use xlink:href="#lnr-heart"></use></svg>
<svg id="fxb" onclick="TgFX()"><use xlink:href="#lnr-star"></use></svg> <svg id="fxb" onclick="CV(3)"><use xlink:href="#lnr-star"></use></svg>
<svg id="nlb" onclick="TgNl()"><use xlink:href="#lnr-moon"></use></svg> <svg id="nlb" onclick="CV(4)"><use xlink:href="#lnr-moon"></use></svg>
<svg id="nsb" onclick="TgN()"><use xlink:href="#lnr-sync"></use></svg> <svg id="nsb" onclick="TgN()"><use xlink:href="#lnr-sync"></use></svg>
<svg id="stb" onclick="TgSettings()"><use xlink:href="#lnr-cog"></use></svg> <svg id="stb" onclick="TgS()"><use xlink:href="#lnr-cog"></use></svg>
</div> </div>
<div id="cdB" class="ctrl_box"> <div id="cdB" class="ctrl_box">
<form id="form_c" name="Cf"> <form id="form_c" name="Cf">
<br> <br>
<div id="slA" class="sliderA"> <div id="slA" class="sl">
<input type="range" title="Brightness" class="sliders" name="SA" value="0" min="0" max="255" step="1" onchange="GetCheck()"> </div> <input type="range" title="Brightness" class="sds" name="SA" value="0" min="0" max="255" step="1" onchange="GC()"></div>
<div id="slR" class="sliderR"> <div id="srgb">
<input type="range" title="Red Value" class="sliders" name="SR" value="0" min="0" max="255" step="1" onchange="GetCheck()"> </div> <div id="slR" class="sl">
<div id="slG" class="sliderG"> <input type="range" title="Red Value" class="sds" name="SR" value="0" min="0" max="255" step="1" onchange="GC()"></div>
<input type="range" title="Green Value" class="sliders" name="SG" value="0" min="0" max="255" step="1" onchange="GetCheck()"> </div> <div id="slG" class="sl">
<div id="slB" class="sliderB"> <input type="range" title="Green Value" class="sds" name="SG" value="0" min="0" max="255" step="1" onchange="GC()"></div>
<input type="range" title="Blue Value" class="sliders" name="SB" value="0" min="0" max="255" step="1" onchange="GetCheck()"> </div> <div id="slB" class="sl">
<div id="slH" class="sliderH"> <input type="range" title="Blue Value" class="sds" name="SB" value="0" min="0" max="255" step="1" onchange="GC()"></div></div>
<input type="range" title="Hue" class="sliders" name="SH" value="0" min="0" max="1" step="0.025" onchange="GetRGB()"> </div> <div id="shs">
<div id="slS" class="sliderS"> <div id="slH" class="sl">
<input type="range" title="Saturation" class="sliders" name="SS" value="0" min="0" max="1" step="0.025" onchange="GetRGB()"> </div> <input type="range" title="Hue" class="sds" name="SH" value="0" min="0" max="1" step="0.025" onchange="GetRGB()"></div>
<div id="slW" class="sliderW"> <div id="slS" class="sl">
<input type="range" title="White Value" class="sliders" name="SW" value="0" min="0" max="255" step="1" onchange="GetCheck()"> </div> <input type="range" title="Saturation" class="sds" name="SS" value="0" min="0" max="1" step="0.025" onchange="GetRGB()"></div></div>
<div id="tlX" class = "toolsFX"> <div id="slW" class="sl">
<input type="range" title="White Value" class="sds" name="SW" value="0" min="0" max="255" step="1" onchange="GC()"></div>
<div id="tlX" class = "tools">
Effect Panel<br><br> Effect Panel<br><br>
<svg id="fmr" onclick="SwitchFX(-100)"><use xlink:href="#lnr-cross"></use></svg> <svg id="fmr" onclick="SwFX(-99)"><use xlink:href="#lnr-cross"></use></svg>
<svg id="for" onclick="SwitchFX(-1)"><use xlink:href="#lnr-arrow-left-circle"></use></svg> <svg id="for" onclick="SwFX(-1)"><use xlink:href="#lnr-arrow-left-circle"></use></svg>
<svg id="fmf" onclick="SwitchFX(1)"><use xlink:href="#lnr-arrow-right-circle"></use></svg> <svg id="fmf" onclick="SwFX(1)"><use xlink:href="#lnr-arrow-right-circle"></use></svg>
<svg id="fof" onclick="SwitchFX(100)"><use xlink:href="#lnr-rocket"></use></svg> <svg id="fof" onclick="SwFX(99)"><use xlink:href="#lnr-rocket"></use></svg><br><br>
<br><input id="fxI" name = "TF" type="number" value="0" min="0" max="57" step="1" onchange="GetFX()"><br><br> <select name="TX" onchange="GX()">
<option value="0" selected>Static (0)</option>
<option value="1">Blink (1)</option>
<option value="2">Breath (2)</option>
<option value="3">Wipe (3)</option>
<option value="4">Wipe Random (4)</option>
<option value="5">Color R (5)</option>
<option value="6">Single Dynamic (6)</option>
<option value="7">All Dynamic (7)</option>
<option value="8">Colorloop (8)</option>
<option value="9">Rainbow (9)</option>
<option value="10">Scan (10)</option>
<option value="11">Scan x2 (11)</option>
<option value="12">Fade (12)</option>
<option value="13">Chase (13)</option>
<option value="14">Chase Cl (14)</option>
<option value="15">Running (15)</option>
<option value="16">Twinkle (16)</option>
<option value="17">Twinkle R (17)</option>
<option value="18">Twinkle Fade (18)</option>
<option value="19">Twinkle RF (19)</option>
<option value="20">Sparkle (20)</option>
<option value="21">Sparkle Inv (21)</option>
<option value="22">Sparkle Inv+ (22)</option>
<option value="23">Strobe (23)</option>
<option value="24">Strobe Cl (24)</option>
<option value="25">Strobe + (25)</option>
<option value="26">Blink Cl (26)</option>
<option value="27">Chase (27)</option>
<option value="28">Chase Inv (28)</option>
<option value="29">Chase R (29)</option>
<option value="30">Chase Rainbow (30)</option>
<option value="31">Chase Flash (31)</option>
<option value="32">Chase RF (32)</option>
<option value="33">Chase Cl Inv (33)</option>
<option value="34">Colorful (34)</option>
<option value="35">Traffic Light (35)</option>
<option value="36">Sweep R(36)</option>
<option value="37">Running 2 (37)</option>
<option value="38">Red/Blue (38)</option>
<option value="39">Running R (39)</option>
<option value="40">Scanner (40)</option>
<option value="41">Lighthouse (41)</option>
<option value="42">Fireworks (42)</option>
<option value="43">Fireworks R (43)</option>
<option value="44">Christmas (44)</option>
<option value="45">Fire Flicker (45)</option>
<option value="46">Unused (46)</option>
<option value="47">Internal (47)</option>
<option value="48">Wipe IO (48)</option>
<option value="49">Wipe II (49)</option>
<option value="50">Wipe OO (50)</option>
<option value="51">Wipe OI (51)</option>
<option value="52">Circus (52)</option>
<option value="53">Custom Chase (53)</option>
<option value="54">CC Colorloop (54)</option>
<option value="55">CC Rainbow (55)</option>
<option value="56">CC Blink (56)</option>
<option value="57">CC Random (57)</option>
</select><br><br>
Set secondary color to Set secondary color to
<button type="button" onclick="ColSec(0)">White</button> <button type="button" onclick="CS(0)">White</button>
<button type="button" onclick="ColSec(1)">Black</button> <button type="button" onclick="CS(1)">Black</button>
<button type="button" onclick="ColSec(2)">Random</button> <button type="button" onclick="CS(2)">Random</button>
<button type="button" onclick="ColSec(3)">Primary</button> <button type="button" onclick="CS(3)">Primary</button>
<button type="button" onclick="ColSec(4)">Swap P/S</button> <button type="button" onclick="CS(4)">Swap P/S</button>
or <button type="button" onclick="ColSec(5)">Set Primary to Random</button> or <button type="button" onclick="CS(5)">Set Primary to Random</button>
<div id="ccX" class = "toolsCC"> <div id="ccX">
<br>Custom Theater Chase<br> <br>Custom Theater Chase<br>
using <input id="ccP" name="PF" type="number" value="2" min="0" max="255" step="1" onchange="GetCC()"> primary and using <input id="ccP" name="PF" type="number" value="2" min="0" max="255" step="1" onchange="GetCC()"> primary and
<input id="ccS" name ="SF" type="number" value="4" min="0" max="255" step="1" onchange="GetCC()"> secondary color LEDs,<br> <input id="ccS" name ="SF" type="number" value="4" min="0" max="255" step="1" onchange="GetCC()"> secondary color LEDs,<br>
doing <input id="ccH" name="HF" type="number" value="1" min="0" max="255" step="1" onchange="GetCC()"> steps per tick, doing <input id="ccH" name="HF" type="number" value="1" min="0" max="255" step="1" onchange="GetCC()"> steps per tick,
from <input type="checkbox" onchange="GetCC()" name="SC"> start and <input type="checkbox" onchange="GetCC()" name="EC"> end. from <input type="checkbox" onchange="GetCC()" name="SC"> start and <input type="checkbox" onchange="GetCC()" name="EC"> end.
</div> </div>
<div id="slX" class="sl">
<input type="range" title="Effect Speed" class="sds" name="SX" value="0" min="0" max="255" step="1" onchange="GX()"></div>
<div id="slI" class="sl">
<input type="range" title="Effect Intensity" class="sds" name="IX" value="0" min="0" max="255" step="1" onchange="GX()"></div>
</div> </div>
<div id="tlP" class = "toolsPS"> <div id="tlP" class = "tools">
Favorite Presets<br><br> Favorite Presets<br><br>
<svg id="psl" onclick="PSIO(false)"><use xlink:href="#lnr-checkmark-circle"></use></svg> <svg id="psl" onclick="PSIO(false)"><use xlink:href="#lnr-checkmark-circle"></use></svg>
<svg id="psp" onclick="SwitchPS(-1)"><use xlink:href="#lnr-arrow-left-circle"></use></svg> <svg id="psp" onclick="SwitchPS(-1)"><use xlink:href="#lnr-arrow-left-circle"></use></svg>
@ -639,8 +654,17 @@
Click checkmark to apply <input type="checkbox" checked="true" name="BC"> brightness, <input type="checkbox" checked="true" name="CC"> color and <input type="checkbox" checked="true" name="FC"> effects.<br> Click checkmark to apply <input type="checkbox" checked="true" name="BC"> brightness, <input type="checkbox" checked="true" name="CC"> color and <input type="checkbox" checked="true" name="FC"> effects.<br>
Effect 0 is the configuration when the light is powered up. Effect 0 is the configuration when the light is powered up.
</div> </div>
<div id="slX" class="sliderX"> <div id="tlN" class="tools">
<input type="range" title="Effect Speed" class="sliders" name="SX" value="0" min="0" max="255" step="1" onchange="GetFX()"> </div> <br> Timed Light<br><br>
<svg id="ntb" onclick="TgNl()"><use xlink:href="#lnr-power-switch"></use></svg><br><br>
Gradually dim down <input type="checkbox" checked="true" name="NC"><br>
1st slider sets duration (1-255min), 2nd sets target brightness.
<div id="slN" class="sl">
<input type="range" title="Duration" class="sds" name="SN" value="60" min="1" max="255" step="1"></div>
<div id="slT" class="sl">
<input type="range" title="Target Brightness" class="sds" name="ST" value="0" min="0" max="255" step="1"></div>
</div>
<br>
</form> </form>
</div> </div>
<iframe id="stf" src="about:blank"></iframe> <iframe id="stf" src="about:blank"></iframe>

43
wled00/data/msg.htm Normal file
View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>WLED Message</title>
<script>
function B() {
window.history.back();
}
</script>
<style>
:root {
--aCol: #D9B310;
--bCol: #0B3C5D;
--cCol: #1D2731;
--dCol: #328CC1;
--sCol: #000;
}
body {
font-family: Verdana, Helvetica, sans-serif;
text-align: center;
background: var(--cCol);
color: var(--dCol);
line-height: 200%;
margin: 0;
background-attachment: fixed;
}
button {
background: var(--bCol);
color: var(--dCol);
border: 0.3ch solid var(--bCol);
display: inline-block;
filter: drop-shadow( -5px -5px 5px var(--sCol) );
font-size: 20px;
margin: 8px;
margin-top: 12px;
}
</style>
</head>
<body>
<h2>Sample message.</h2>
</body>
</html>

View File

@ -1,135 +1,41 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>WLED Settings</title>
<title>Settings</title>
<script>
function GetCurrent()
{
var d = document;
//values injected by server while sending HTML
d.Sf.CSSID.value = "DONT put settings.htm in SPIFFS!";
d.getElementsByClassName("msg")[0].innerHTML = "Response Error";
}
</script>
<style> <style>
body { :root {
line-height: 150%; --aCol: #D9B310;
--bCol: #0B3C5D;
--cCol: #1D2731;
--dCol: #328CC1;
--sCol: #000;
} }
input[type=number] { body {
width: 3em; font-family: Verdana, Helvetica, sans-serif;
text-align: center;
background: var(--cCol);
height: 100%;
margin: 0;
background-attachment: fixed;
}
button {
background: var(--bCol);
color: var(--dCol);
border: 0.3ch solid var(--bCol);
display: inline-block;
filter: drop-shadow( -5px -5px 5px var(--sCol) );
font-size: 9vmin;
width: 95%;
margin-top: 2.4vh;
} }
</style> </style>
</head> </head>
<body onload="GetCurrent()" class=" __plain_text_READY__"> <body>
<h1 style="text-align:center">WLED Settings</h1> <form action="/settings/wifi" method="post"><button type="submit">WiFi Setup</button></form>
<form id="form_s" name="Sf" action="set-settings" method="post"> <form action="/settings/leds" method="post"><button type="submit">LED Preferences</button></form>
<div align="center"><input type="submit" name="SUBM" value="Save"></div> <form action="/settings/ui" method="post"><button type="submit">User Interface</button></form>
<hr> <form action="/settings/sync" method="post"><button type="submit">Sync Interfaces</button></form>
<h2>WiFi setup</h2> <form action="/settings/time" method="post"><button type="submit">Time & Macros</button></form>
<h3>Connect to existing network</h3> <form action="/settings/sec" method="post"><button type="submit">Security & Updates</button></form>
Network SSID (leave empty to not connect): <br><input name="CSSID" maxlength="32"> <br>
Network password: <br> <input type="password" name="CPASS" maxlength="63"> <br>
Static IP (leave at 0.0.0.0 for DHCP): <br>
<input name="CSIP0" type="number" min="0" max="255" required> .
<input name="CSIP1" type="number" min="0" max="255" required> .
<input name="CSIP2" type="number" min="0" max="255" required> .
<input name="CSIP3" type="number" min="0" max="255" required> <br>
Static gateway: <br>
<input name="CSGW0" type="number" min="0" max="255" required> .
<input name="CSGW1" type="number" min="0" max="255" required> .
<input name="CSGW2" type="number" min="0" max="255" required> .
<input name="CSGW3" type="number" min="0" max="255" required> <br>
Static subnet mask: <br>
<input name="CSSN0" type="number" min="0" max="255" required> .
<input name="CSSN1" type="number" min="0" max="255" required> .
<input name="CSSN2" type="number" min="0" max="255" required> .
<input name="CSSN3" type="number" min="0" max="255" required> <br>
mDNS address (leave empty for no mDNS): <br/>
http:// <input name="CMDNS" maxlength="32"> .local <br>
Try connecting before opening AP for: <input name="APWTM" type="number" min="0" max="255" required> s <br>
Client IP: <span class="sip"> Not connected </span> <br>
<h3>Configure Access Point</h3>
AP SSID (leave empty for no AP): <br> <input name="APSSID" maxlength="32"> <br>
Hide AP SSID: <input type="checkbox" name="APHSSID"> <br>
AP password (leave empty for open): <br> <input type="password" name="APPASS" maxlength="63"> <br>
AP channel: <input name="APCHAN" type="number" min="1" max="13" required> <br>
AP IP: <span class="sip"> Not active </span> <br>
<hr>
<h2>Application setup</h2>
<h3>Web setup</h3>
Server description: <input name="DESC" maxlength="32"> <br>
Use HSB sliders instead of RGB by default: <input type="checkbox" name="COLMD"> <br>
<h3>LED setup</h3>
LED count (max. 255): <input name="LEDCN" type="number" min="1" max="255" required> <br>
<i>The default boot color is always saved in preset slot 0.</i><br>
Alternatively, apply preset <input name="BOOTP" type="number" min="0" max="25" required> at boot<br>
Default RGB color:
<input name="CLDFR" type="number" min="0" max="255" required>
<input name="CLDFG" type="number" min="0" max="255" required>
<input name="CLDFB" type="number" min="0" max="255" required> <br>
Default brightness: <input name="CLDFA" type="number" min="0" max="255" required> (0-255) <br>
Default white value (only RGBW, -1 to disable): <input name="CLDFW" type="number" min="-1" max="255" required> <br>
Default effect ID: <input name="FXDEF" type="number" min="0" max="57" required> <br>
Default effect speed: <input name="SXDEF" type="number" min="0" max="255" required> <br>
Ignore and use current color, brightness and effects: <input type="checkbox" name="CBEOR"> <br>
Turn on after power up/reset: <input type="checkbox" name="BOOTN"> <br>
Use Gamma correction for brightness: <input type="checkbox" name="GCBRI"> <br>
Use Gamma correction for color: <input type="checkbox" name="GCRGB"> <br>
Brightness factor: <input name="NRBRI" type="number" min="0" max="255" required> % <br>
<h3>Button setup</h3>
On/Off button enabled: <input type="checkbox" name="BTNON"> <br>
<h3>Transitions</h3>
Fade: <input type="checkbox" name="TFADE"> <br>
Sweep: <input type="checkbox" name="TSWEE"> Invert direction: <input type="checkbox" name="TSDIR"><br>
Transition Delay: <input name="TDLAY" maxlength="5" size="2"> ms <br>
<h3>Timed light</h3>
Target brightness: <input name="TLBRI" type="number" min="0" max="255" required> (0-255) <br>
Change after: <input name="TLDUR" type="number" min="0" max="255" required> min <br>
Fade: <input type="checkbox" name="TLFDE"> <br>
<h3>Broadcast</h3>
UDP Port: <input name="NUDPP" maxlength="5" size="2"><br>
Receive notifications: <input type="checkbox" name="NRCVE"> <br>
Send notifications on direct change: <input type="checkbox" name="NSDIR"> <br>
Send notifications on button press: <input type="checkbox" name="NSBTN"> <br>
<h3>Interfaces</h3>
Emulate Alexa device: <input type="checkbox" name="ALEXA"> <br>
Alexa invocation name: <input name="AINVN" maxlength="32"><br>
Send Alexa notifications: <input type="checkbox" name="NSALX"> <br>
<h3>Time (experimental!)</h3>
Requires reboot. <br>
Get time from NTP server: <input type="checkbox" name="NTPON"> <br>
Current local time is <span class="times">unknown</span> <br>
<h3>Advanced</h3>
Default overlay ID: <input name="OLDEF" type="number" min="0" max="255" required> <br>
WARLS offset: <input name="WOFFS" type="number" min="-255" max="255" required><br>
<h3>Security</h3>
OTA locked: <input type="checkbox" name="NOOTA"> <br>
Passphrase: <input type="password" name="OPASS" maxlength="32"> <br>
To enable OTA, for security reasons you need to also enter the correct password! <br>
The password may/should be changed when OTA is enabled. <br>
Disable OTA when not in use, otherwise an attacker could reflash device software! <br> <br>
Disable recovery AP: <input type="checkbox" name="NORAP"> <br>
In case of a connection error there will be no wireless recovery possible! <br>
Completely disables all Access Point functions. <br>
Setting only changable if OTA is enabled! <br><br>
Factory reset: <input type="checkbox" name="RESET"> <br>
All EEPROM content (settings) will be erased. <br> <br>
HTTP traffic is not encrypted. An attacker in the same network could intercept form data!<br>
<h3>About</h3>
WLED version 0.5dev <br>
(c) 2016-2018 Christian Schwinne <br>
<i>Licensed under the MIT license</i> <br><br>
<i>Uses libraries:</i> <br>
<i>ESP8266 Arduino Core</i> <br>
<i>WS2812FX by kitesurfer1404 (Aircoookie fork)</i> <br>
<i>Timezone library by JChristensen</i> <br>
<i>arduino-esp8266-alexa-multiple-wemo-switch by kakopappa</i> <br><br>
<i>UI icons by <a href="https://linearicons.com">Linearicons</a> created by <a href="https://perxis.com">Perxis</a>! (CC-BY-SA 4.0)</i> <br><br>
Server message: <span class="msg"> XML response error! </span>
<br><br><hr>
<div align="center"><input type="submit" name="SUBM" value="Save"></div>
</form>
</body> </body>
</html> </html>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
wled00/data/settings_ui.htm Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Saved Settings</title>
<script>
function OpenReboot()
{
window.open("/reset","_self");
}
</script>
</head><body>
<div align="center">
<h2>Settings saved.</h2>
<p>If you made changes to WiFi configuration, please reboot.</p><br>
<input type="button" value="Reboot" onclick="OpenReboot()">
</div></body>
</html>

43
wled00/data/welcome.htm Normal file
View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>WLED Setup</title>
<style>
:root {
--aCol: #D9B310;
--bCol: #0B3C5D;
--cCol: #1D2731;
--dCol: #328CC1;
--sCol: #000;
}
body {
font-family: Verdana, Helvetica, sans-serif;
text-align: center;
background: linear-gradient(var(--bCol),black);
height: 100%;
margin: 0;
background-repeat: no-repeat;
background-attachment: fixed;
color: var(--dCol);
}
svg {
fill: var(--dCol);
}
</style>
</head>
<body>
<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="lnr-smile" viewBox="0 0 1024 1024"><path d="M486.4 1024c-129.922 0-252.067-50.594-343.936-142.464s-142.464-214.014-142.464-343.936c0-129.923 50.595-252.067 142.464-343.936s214.013-142.464 343.936-142.464c129.922 0 252.067 50.595 343.936 142.464s142.464 214.014 142.464 343.936-50.594 252.067-142.464 343.936c-91.869 91.87-214.014 142.464-343.936 142.464zM486.4 102.4c-239.97 0-435.2 195.23-435.2 435.2s195.23 435.2 435.2 435.2 435.2-195.23 435.2-435.2-195.23-435.2-435.2-435.2z"></path><path d="M332.8 409.6c-42.347 0-76.8-34.453-76.8-76.8s34.453-76.8 76.8-76.8 76.8 34.453 76.8 76.8-34.453 76.8-76.8 76.8zM332.8 307.2c-14.115 0-25.6 11.485-25.6 25.6s11.485 25.6 25.6 25.6 25.6-11.485 25.6-25.6-11.485-25.6-25.6-25.6z"></path><path d="M640 409.6c-42.349 0-76.8-34.453-76.8-76.8s34.451-76.8 76.8-76.8 76.8 34.453 76.8 76.8-34.451 76.8-76.8 76.8zM640 307.2c-14.115 0-25.6 11.485-25.6 25.6s11.485 25.6 25.6 25.6 25.6-11.485 25.6-25.6-11.485-25.6-25.6-25.6z"></path><path d="M486.4 870.4c-183.506 0-332.8-149.294-332.8-332.8 0-14.139 11.462-25.6 25.6-25.6s25.6 11.461 25.6 25.6c0 155.275 126.325 281.6 281.6 281.6s281.6-126.325 281.6-281.6c0-14.139 11.461-25.6 25.6-25.6s25.6 11.461 25.6 25.6c0 183.506-149.294 332.8-332.8 332.8z"></path></symbol>
</defs></svg>
<br><br>
<svg><use xlink:href="#lnr-smile"></use></svg>
<h1>Welcome to WLED!</h1>
<h3>Thank you for installing my application!</h3>
Take a quick look at the <a href="https://github.com/Aircoookie/WLED/wiki" target="_blank">wiki</a>!<br>
If you encounter a bug or have a question/feature suggestion, feel free to open a GitHub issue!<br><br>
<b>Next steps:</b><br><br>
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>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -1,157 +1,17 @@
/* /*
* Settings html (part 1) * Settings html
*/ */
const char PAGE_settings0[] PROGMEM = R"=====( const char PAGE_settings0[] PROGMEM = R"=====(
<!DOCTYPE html>
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<title>Settings</title>
<script>function GetCurrent(){
var d=document;
)====="; )=====";
const char PAGE_settings1[] PROGMEM = R"=====( const char PAGE_settings1[] PROGMEM = R"=====(
}</script>
<style>
body {
line-height: 150%;
}
input[type=number] {width: 3em;}
</style>
</head>
<body onload="GetCurrent()" class=" __plain_text_READY__">
<h1 style="text-align:center">WLED Settings</h1>
<form id="form_s" name="Sf" action="set-settings" method="post">
<div align="center"><input type="submit" name="SUBM" value="Save"></div>
<hr>
<h2>WiFi setup</h2>
<h3>Connect to existing network</h3>
Network SSID (leave empty to not connect): <br><input name="CSSID" maxlength="32"> <br>
Network password: <br> <input type="password" name="CPASS" maxlength="63"> <br>
Static IP (leave at 0.0.0.0 for DHCP): <br>
<input name="CSIP0" type="number" min="0" max="255" required> .
<input name="CSIP1" type="number" min="0" max="255" required> .
<input name="CSIP2" type="number" min="0" max="255" required> .
<input name="CSIP3" type="number" min="0" max="255" required> <br>
Static gateway: <br>
<input name="CSGW0" type="number" min="0" max="255" required> .
<input name="CSGW1" type="number" min="0" max="255" required> .
<input name="CSGW2" type="number" min="0" max="255" required> .
<input name="CSGW3" type="number" min="0" max="255" required> <br>
Static subnet mask: <br>
<input name="CSSN0" type="number" min="0" max="255" required> .
<input name="CSSN1" type="number" min="0" max="255" required> .
<input name="CSSN2" type="number" min="0" max="255" required> .
<input name="CSSN3" type="number" min="0" max="255" required> <br>
mDNS address (leave empty for no mDNS): <br/>
http:// <input name="CMDNS" maxlength="32"> .local <br>
Try connecting before opening AP for: <input name="APWTM" type="number" min="0" max="255" required> s <br>
Client IP: <span class="sip"> Not connected </span> <br>
<h3>Configure Access Point</h3>
AP SSID (leave empty for no AP): <br> <input name="APSSID" maxlength="32"> <br>
Hide AP SSID: <input type="checkbox" name="APHSSID"> <br>
AP password (leave empty for open): <br> <input type="password" name="APPASS" maxlength="63"> <br>
AP channel: <input name="APCHAN" maxlength="2" size="2"> <br>
AP IP: <span class="sip"> Not active </span> <br>
<hr>
<h2>Application setup</h2>
<h3>Web setup</h3>
Server description: <input name="DESC" maxlength="32"> <br>
Use HSB sliders instead of RGB by default: <input type="checkbox" name="COLMD"> <br>
<h3>LED setup</h3>
LED count (max. 255): <input name="LEDCN" type="number" min="1" max="255" required> <br>
<i>The default boot color is saved in preset slot 0.</i><br>
Alternatively, apply preset <input name="BOOTP" type="number" min="0" max="25" required> at boot<br>
Default RGB color:
<input name="CLDFR" type="number" min="0" max="255" required>
<input name="CLDFG" type="number" min="0" max="255" required>
<input name="CLDFB" type="number" min="0" max="255" required> <br>
Default brightness: <input name="CLDFA" type="number" min="0" max="255" required> (0-255) <br>
Default white value (only RGBW, -1 to disable): <input name="CLDFW" type="number" min="-1" max="255" required> <br>
Default effect ID: <input name="FXDEF" type="number" min="0" max="255" required> <br>
Default effect speed: <input name="SXDEF" type="number" min="0" max="255" required> <br>
Ignore and use current color, brightness and effects: <input type="checkbox" name="CBEOR"> <br>
Turn on after power up/reset: <input type="checkbox" name="BOOTN"> <br>
Use Gamma correction for brightness: <input type="checkbox" name="GCBRI"> <br>
Use Gamma correction for color: <input type="checkbox" name="GCRGB"> <br>
Brightness factor: <input name="NRBRI" type="number" min="0" max="255" required> % <br>
<h3>Button setup</h3>
On/Off button enabled: <input type="checkbox" name="BTNON"> <br>
<h3>Transitions</h3>
Fade: <input type="checkbox" name="TFADE"> <br>
Sweep: <input type="checkbox" name="TSWEE"> Invert direction: <input type="checkbox" name="TSDIR"><br>
Transition Delay: <input name="TDLAY" maxlength="5" size="2"> ms <br>
<h3>Timed light</h3>
Target brightness: <input name="TLBRI" type="number" min="0" max="255" required> (0-255) <br>
Change after: <input name="TLDUR" type="number" min="0" max="255" required> min <br>
Fade: <input type="checkbox" name="TLFDE"> <br>
<h3>Broadcast</h3>
UDP Port: <input name="NUDPP" maxlength="5" size="2"><br>
Receive notifications: <input type="checkbox" name="NRCVE"> <br>
Send notifications on direct change: <input type="checkbox" name="NSDIR"> <br>
Send notifications on button press: <input type="checkbox" name="NSBTN"> <br>
<h3>Interfaces</h3>
Emulate Alexa device: <input type="checkbox" name="ALEXA"> <br>
Alexa invocation name: <input name="AINVN" maxlength="32"><br>
Send Alexa notifications: <input type="checkbox" name="NSALX"> <br>
<h3>Time (experimental!)</h3>
Requires reboot. <br>
Get time from NTP server: <input type="checkbox" name="NTPON"> <br>
Current local time is <span class="times">unknown</span> <br>
<h3>Advanced</h3>
Default overlay ID: <input name="OLDEF" type="number" min="0" max="255" required> <br>
WARLS offset: <input name="WOFFS" type="number" min="-255" max="255" required><br>
<h3>Security</h3>
OTA locked: <input type="checkbox" name="NOOTA"> <br>
Passphrase: <input type="password" name="OPASS" maxlength="32"> <br>
To enable OTA, for security reasons you need to also enter the correct password! <br>
The password may/should be changed when OTA is enabled. <br>
Disable OTA when not in use, otherwise an attacker could reflash device software! <br> <br>
Disable recovery AP: <input type="checkbox" name="NORAP"> <br>
In case of a connection error there will be no wireless recovery possible! <br>
Completely disables all Access Point functions. <br>
Setting only changable if OTA is enabled! <br><br>
Factory reset: <input type="checkbox" name="RESET"> <br>
All EEPROM content (settings) will be erased. <br> <br>
HTTP traffic is not encrypted. An attacker in the same network could intercept form data!<br>
<h3>About</h3>
WLED version 0.5dev <br>
(c) 2016-2018 Christian Schwinne <br>
<i>Licensed under the MIT license</i> <br><br>
<i>Uses libraries:</i> <br>
<i>ESP8266 Arduino Core</i> <br>
<i>WS2812FX by kitesurfer1404 (Aircoookie fork)</i> <br>
<i>Timezone library by JChristensen</i> <br>
<i>arduino-esp8266-alexa-multiple-wemo-switch by kakopappa</i> <br><br>
<i>UI icons by <a href="https://linearicons.com">Linearicons</a> created by <a href="https://perxis.com">Perxis</a>! (CC-BY-SA 4.0)</i> <br><br>
Server message: <span class="msg"> XML response error! </span>
<br><br><hr>
<div align="center"><input type="submit" name="SUBM" value="Save"></div>
</form>
</body>
</html>
)====="; )=====";
/* /*
* Settings set html * Settings set html
*/ */
const char PAGE_settingssaved[] PROGMEM = R"=====( const char PAGE_msg[] PROGMEM = R"=====(
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Saved Settings</title>
<script>
function OpenReboot()
{
window.open("/reset","_self");
}
</script>
</head><body>
<div align="center">
<h2>Settings saved.</h2>
<p>If you made changes to WiFi configuration, please reboot.</p><br>
<input type="button" value="Reboot" onclick="OpenReboot()">
</div></body>
</html>
)====="; )=====";

33
wled00/htmls02.h Normal file

File diff suppressed because one or more lines are too long

View File

@ -29,7 +29,7 @@
#include "WS2812FX.h" #include "WS2812FX.h"
//version in format yymmddb (b = daily build) //version in format yymmddb (b = daily build)
#define VERSION 1801164 #define VERSION 1801180
const String versionName = "WLED 0.5dev"; const String versionName = "WLED 0.5dev";
//AP and OTA default passwords (change them!) //AP and OTA default passwords (change them!)
@ -45,7 +45,7 @@ boolean useRGBW = false;
//support for the CRONIXIE clock by Diamex (disable overlays!) //support for the CRONIXIE clock by Diamex (disable overlays!)
//#define CRONIXIE //#define CRONIXIE
//spiffs FS only useful for debug //spiffs FS only useful for debug (only ESP8266)
//#define USEFS //#define USEFS
//to toggle usb serial debug (un)comment following line //to toggle usb serial debug (un)comment following line
@ -53,7 +53,6 @@ boolean useRGBW = false;
//Hardware-settings (only changeble via code) //Hardware-settings (only changeble via code)
#define LEDCOUNT 255 //maximum, exact count set-able via settings #define LEDCOUNT 255 //maximum, exact count set-able via settings
#define MAXDIRECT 255 //for direct access like arls, should be >= LEDCOUNT
uint8_t buttonPin = 0; //needs pull-up uint8_t buttonPin = 0; //needs pull-up
uint8_t auxPin = 15; //use e.g. for external relay uint8_t auxPin = 15; //use e.g. for external relay
uint8_t auxDefaultState = 0; //0: input 1: high 2: low uint8_t auxDefaultState = 0; //0: input 1: high 2: low
@ -69,8 +68,6 @@ time_t local;
#ifdef CRONIXIE #ifdef CRONIXIE
#undef LEDCOUNT #undef LEDCOUNT
#define LEDCOUNT 60 #define LEDCOUNT 60
#undef MAXDIRECT
#define MAXDIRECT 48
uint8_t ledcount = 6; uint8_t ledcount = 6;
String apssid = "CRONIXIE-AP"; String apssid = "CRONIXIE-AP";
String alexaInvocationName = "Clock"; String alexaInvocationName = "Clock";
@ -124,6 +121,7 @@ boolean nightlightFade = true;
uint16_t udpPort = 21324; uint16_t udpPort = 21324;
uint8_t effectDefault = 0; uint8_t effectDefault = 0;
uint8_t effectSpeedDefault = 75; uint8_t effectSpeedDefault = 75;
uint8_t effectIntensityDefault = 128;
//NTP stuff //NTP stuff
#ifndef CRONIXIE #ifndef CRONIXIE
boolean ntpEnabled = false; boolean ntpEnabled = false;
@ -177,8 +175,9 @@ boolean nightlightActive_old = false;
int nightlightDelayMs; int nightlightDelayMs;
uint8_t effectCurrent = 0; uint8_t effectCurrent = 0;
uint8_t effectSpeed = 75; uint8_t effectSpeed = 75;
uint8_t effectIntensity = 128;
boolean udpConnected = false; boolean udpConnected = false;
byte udpIn[MAXDIRECT*4+2]; byte udpIn[1026];
//NTP stuff //NTP stuff
boolean ntpConnected = false; boolean ntpConnected = false;
unsigned int ntpLocalPort = 2390; unsigned int ntpLocalPort = 2390;
@ -218,6 +217,7 @@ boolean arlsSign = true;
uint8_t auxTime = 0; uint8_t auxTime = 0;
unsigned long auxStartTime; unsigned long auxStartTime;
boolean auxActive, auxActiveBefore; boolean auxActive, auxActiveBefore;
boolean initialBoot = false;
boolean useGammaCorrectionBri = false; boolean useGammaCorrectionBri = false;
boolean useGammaCorrectionRGB = true; boolean useGammaCorrectionRGB = true;
@ -243,11 +243,12 @@ WiFiUDP ntpUdp;
WS2812FX strip = WS2812FX(LEDCOUNT); WS2812FX strip = WS2812FX(LEDCOUNT);
//eeprom Version code, enables default settings instead of 0 init on update //eeprom Version code, enables default settings instead of 0 init on update
#define EEPVER 3 #define EEPVER 4
//0 -> old version, default //0 -> old version, default
//1 -> 0.4p 1711272 and up //1 -> 0.4p 1711272 and up
//2 -> 0.4p 1711302 and up //2 -> 0.4p 1711302 and up
//3 -> 0.4 1712121 and up //3 -> 0.4 1712121 and up
//4 -> 0.5dev 1801271 and up
#ifdef DEBUG #ifdef DEBUG
#define DEBUG_PRINT(x) Serial.print (x) #define DEBUG_PRINT(x) Serial.print (x)

View File

@ -87,7 +87,7 @@ void saveSettingsToEEPROM()
} }
EEPROM.write(324, effectDefault); EEPROM.write(324, effectDefault);
EEPROM.write(325, effectSpeedDefault); EEPROM.write(325, effectSpeedDefault);
//326 reserved for effectIntensity EEPROM.write(326, effectIntensityDefault);
EEPROM.write(327, ntpEnabled); EEPROM.write(327, ntpEnabled);
//328 reserved for timezone setting //328 reserved for timezone setting
//329 reserved for dst setting //329 reserved for dst setting
@ -246,10 +246,10 @@ void loadSettingsFromEEPROM(bool first)
} }
//377 = lastEEPROMversion //377 = lastEEPROMversion
if (lastEEPROMversion > 1) { if (lastEEPROMversion > 1) {
col_sec_s[0] = EEPROM.read(378); col_sec_s[0] = EEPROM.read(378); col_sec[0] = col_sec_s[0];
col_sec_s[1] = EEPROM.read(379); col_sec_s[1] = EEPROM.read(379); col_sec[1] = col_sec_s[1];
col_sec_s[2] = EEPROM.read(380); col_sec_s[2] = EEPROM.read(380); col_sec[2] = col_sec_s[2];
white_sec_s = EEPROM.read(381); white_sec_s = EEPROM.read(381); white_sec = white_sec_s;
cc_index1 = EEPROM.read(382); cc_index1 = EEPROM.read(382);
cc_index2 = EEPROM.read(383); cc_index2 = EEPROM.read(383);
cc_numPrimary = EEPROM.read(384); cc_numPrimary = EEPROM.read(384);
@ -259,6 +259,9 @@ void loadSettingsFromEEPROM(bool first)
cc_step = EEPROM.read(388); cc_step = EEPROM.read(388);
strip.setCustomChase(cc_index1, cc_index2, cc_start, cc_numPrimary, cc_numSecondary, cc_step, cc_fromStart, cc_fromEnd); strip.setCustomChase(cc_index1, cc_index2, cc_start, cc_numPrimary, cc_numSecondary, cc_step, cc_fromStart, cc_fromEnd);
} }
if (lastEEPROMversion > 3) {
effectIntensityDefault = EEPROM.read(326); effectIntensity = effectIntensityDefault;
}
bootPreset = EEPROM.read(389); bootPreset = EEPROM.read(389);
//favorite setting memory (25 slots/ each 20byte) //favorite setting memory (25 slots/ each 20byte)
@ -271,12 +274,13 @@ void loadSettingsFromEEPROM(bool first)
strip.setMode(effectCurrent); strip.setMode(effectCurrent);
strip.setSpeed(effectSpeed); strip.setSpeed(effectSpeed);
strip.setIntensity(effectIntensity);
overlayCurrent = overlayDefault; overlayCurrent = overlayDefault;
} }
//PRESET PROTOCOL 20 bytes //PRESET PROTOCOL 20 bytes
//0: preset purpose byte 0:invalid 1:valid preset 1.0 //0: preset purpose byte 0:invalid 1:valid preset 1.0
//1:a 2:r 3:g 4:b 5:w 6:er 7:eg 8:eb 9:ew 10:fx 11:sx | custom chase 12:numP 13:numS 14:(0:fs 1:both 2:fe) 15:step 16-19:Zeros //1:a 2:r 3:g 4:b 5:w 6:er 7:eg 8:eb 9:ew 10:fx 11:sx | custom chase 12:numP 13:numS 14:(0:fs 1:both 2:fe) 15:step 16:ix 17-19:Zeros
void applyPreset(uint8_t index, bool loadBri, bool loadCol, bool loadFX) void applyPreset(uint8_t index, bool loadBri, bool loadCol, bool loadFX)
{ {
@ -300,6 +304,7 @@ void applyPreset(uint8_t index, bool loadBri, bool loadCol, bool loadFX)
{ {
effectCurrent = EEPROM.read(i+10); effectCurrent = EEPROM.read(i+10);
effectSpeed = EEPROM.read(i+11); effectSpeed = EEPROM.read(i+11);
effectIntensity = EEPROM.read(i+16);
cc_numPrimary = EEPROM.read(i+12); cc_numPrimary = EEPROM.read(i+12);
cc_numSecondary = EEPROM.read(i+13); cc_numSecondary = EEPROM.read(i+13);
cc_fromEnd = EEPROM.read(i+14); cc_fromEnd = EEPROM.read(i+14);
@ -308,6 +313,7 @@ void applyPreset(uint8_t index, bool loadBri, bool loadCol, bool loadFX)
strip.setCustomChase(cc_index1, cc_index2, cc_start, cc_numPrimary, cc_numSecondary, cc_step, cc_fromStart, cc_fromEnd); strip.setCustomChase(cc_index1, cc_index2, cc_start, cc_numPrimary, cc_numSecondary, cc_step, cc_fromStart, cc_fromEnd);
strip.setMode(effectCurrent); strip.setMode(effectCurrent);
strip.setSpeed(effectSpeed); strip.setSpeed(effectSpeed);
strip.setIntensity(effectIntensity);
} }
} }
@ -335,6 +341,7 @@ void savePreset(uint8_t index)
if (!cc_fromEnd) m = 0; if (!cc_fromEnd) m = 0;
EEPROM.write(i+14, m); EEPROM.write(i+14, m);
EEPROM.write(i+15, cc_step); EEPROM.write(i+15, cc_step);
EEPROM.write(i+16, effectIntensity);
EEPROM.commit(); EEPROM.commit();
} }

View File

@ -33,7 +33,9 @@ void XML_response()
resp = resp + effectCurrent; resp = resp + effectCurrent;
resp = resp + "</fx><sx>"; resp = resp + "</fx><sx>";
resp = resp + effectSpeed; resp = resp + effectSpeed;
resp = resp + "</sx><wv>"; resp = resp + "</sx><ix>";
resp = resp + effectIntensity;
resp = resp + "</ix><wv>";
if (useRGBW) { if (useRGBW) {
resp = resp + white; resp = resp + white;
} else { } else {
@ -49,9 +51,11 @@ void XML_response()
server.send(200, "text/xml", resp); server.send(200, "text/xml", resp);
} }
String getSettings() String getSettings(uint8_t subPage)
{ {
DEBUG_PRINTLN("settings resp"); //0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec
DEBUG_PRINT("settings resp");
DEBUG_PRINTLN(subPage);
String resp = ""; String resp = "";
String ds = "d.Sf."; String ds = "d.Sf.";
@ -103,6 +107,10 @@ String getSettings()
} else { } else {
resp += ds + "CLDFW" + v + "-1;"; resp += ds + "CLDFW" + v + "-1;";
} }
resp += ds + "CSECR" + v + col_sec_s[0] +";";
resp += ds + "CSECG" + v + col_sec_s[1] +";";
resp += ds + "CSECB" + v + col_sec_s[2] +";";
resp += ds + "CSECW" + v + white_s +";";
resp += ds + "BOOTN" + c + turnOnAtBoot +";"; resp += ds + "BOOTN" + c + turnOnAtBoot +";";
resp += ds + "BOOTP" + v + bootPreset +";"; resp += ds + "BOOTP" + v + bootPreset +";";
resp += ds + "FXDEF" + v + effectDefault +";"; resp += ds + "FXDEF" + v + effectDefault +";";

View File

@ -122,11 +122,12 @@ void handleSettingsSet()
if (i >= 0 && i <= LEDCOUNT) ledcount = i; if (i >= 0 && i <= LEDCOUNT) ledcount = i;
strip.setLedCount(ledcount); strip.setLedCount(ledcount);
} }
if (server.hasArg("CBEOR")) if (server.hasArg("CBEOR")) //ignore settings and save current brightness, colors and fx as default
{ {
col_s[0] = col[0]; col_s[0] = col[0];
col_s[1] = col[1]; col_s[1] = col[1];
col_s[2] = col[2]; col_s[2] = col[2];
if (useRGBW) white_s = white;
bri_s = bri; bri_s = bri;
effectDefault = effectCurrent; effectDefault = effectCurrent;
effectSpeedDefault = effectSpeed; effectSpeedDefault = effectSpeed;
@ -146,6 +147,26 @@ void handleSettingsSet()
int i = server.arg("CLDFB").toInt(); int i = server.arg("CLDFB").toInt();
if (i >= 0 && i <= 255) col_s[2] = i; if (i >= 0 && i <= 255) col_s[2] = i;
} }
if (server.hasArg("CSECR"))
{
int i = server.arg("CSECR").toInt();
if (i >= 0 && i <= 255) col_sec_s[0] = i;
}
if (server.hasArg("CSECG"))
{
int i = server.arg("CSECG").toInt();
if (i >= 0 && i <= 255) col_sec_s[1] = i;
}
if (server.hasArg("CSECB"))
{
int i = server.arg("CSECB").toInt();
if (i >= 0 && i <= 255) col_sec_s[2] = i;
}
if (server.hasArg("CSECW"))
{
int i = server.arg("CSECW").toInt();
if (i >= 0 && i <= 255) white_sec_s = i;
}
if (server.hasArg("CLDFW")) if (server.hasArg("CLDFW"))
{ {
int i = server.arg("CLDFW").toInt(); int i = server.arg("CLDFW").toInt();
@ -163,12 +184,6 @@ void handleSettingsSet()
int i = server.arg("CLDFA").toInt(); int i = server.arg("CLDFA").toInt();
if (i >= 0 && i <= 255) bri_s = i; if (i >= 0 && i <= 255) bri_s = i;
} }
turnOnAtBoot = server.hasArg("BOOTN");
if (server.hasArg("BOOTP"))
{
int i = server.arg("BOOTP").toInt();
if (i >= 0 && i <= 25) bootPreset = i;
}
if (server.hasArg("FXDEF")) if (server.hasArg("FXDEF"))
{ {
int i = server.arg("FXDEF").toInt(); int i = server.arg("FXDEF").toInt();
@ -180,6 +195,12 @@ void handleSettingsSet()
if (i >= 0 && i <= 255) effectSpeedDefault = i; if (i >= 0 && i <= 255) effectSpeedDefault = i;
} }
} }
turnOnAtBoot = server.hasArg("BOOTN");
if (server.hasArg("BOOTP"))
{
int i = server.arg("BOOTP").toInt();
if (i >= 0 && i <= 25) bootPreset = i;
}
useGammaCorrectionBri = server.hasArg("GCBRI"); useGammaCorrectionBri = server.hasArg("GCBRI");
useGammaCorrectionRGB = server.hasArg("GCRGB"); useGammaCorrectionRGB = server.hasArg("GCRGB");
buttonEnabled = server.hasArg("BTNON"); buttonEnabled = server.hasArg("BTNON");

View File

@ -87,19 +87,18 @@ void wledInit()
if(!handleFileRead("/favicon.ico")) server.send(200, "image/x-icon", favicon); if(!handleFileRead("/favicon.ico")) server.send(200, "image/x-icon", favicon);
}); });
server.on("/", HTTP_GET, [](){ server.on("/", HTTP_GET, [](){
if (!initialBoot){
if(!handleFileRead("/index.htm")) { if(!handleFileRead("/index.htm")) {
if (!arlsTimeout) //do not serve while receiving realtime serveIndex();
{ }
server.setContentLength(strlen_P(PAGE_index0) + strlen_P(PAGE_index1) + strlen_P(PAGE_index2));
server.send(200, "text/html", "");
server.sendContent_P(PAGE_index0);
server.sendContent_P(PAGE_index1);
server.sendContent_P(PAGE_index2);
}else{ }else{
server.send(200, "text/plain", "The WLED UI is not available while receiving real-time data."); if(!handleFileRead("/welcome.htm")) {
serveWelcomePage();
} }
} }
}); });
server.on("/sliders", HTTP_GET, serveIndex)
server.on("/welcome", HTTP_GET, serveWelcomePage)
server.on("/reset", HTTP_GET, [](){ server.on("/reset", HTTP_GET, [](){
server.send(200, "text/plain", "Rebooting..."); server.send(200, "text/plain", "Rebooting...");
reset(); reset();
@ -134,13 +133,13 @@ void wledInit()
#endif #endif
info += "name: " + versionName + "\r\n"; info += "name: " + versionName + "\r\n";
info += "version: " + (String)VERSION + "\r\n"; info += "version: " + (String)VERSION + "\r\n";
info += "eepver: " + String(EEPVER) + "\r\n";
#ifdef RGBW #ifdef RGBW
info += "rgbw: true\r\n"; info += "rgbw: true\r\n";
#else #else
info += "rgbw: false\r\n"; info += "rgbw: false\r\n";
#endif #endif
info += "max-leds: " + (String)LEDCOUNT + "\r\n"; info += "max-leds: " + (String)LEDCOUNT + "\r\n";
info += "max-direct: " + (String)MAXDIRECT + "\r\n";
#ifdef USEOVERLAYS #ifdef USEOVERLAYS
info += "overlays: true\r\n"; info += "overlays: true\r\n";
#else #else
@ -231,9 +230,7 @@ void wledInit()
// Initialize NeoPixel Strip // Initialize NeoPixel Strip
strip.init(); strip.init();
strip.setLedCount(ledcount); strip.setLedCount(ledcount);
strip.setMode(effectCurrent);
strip.setColor(0); strip.setColor(0);
strip.setSpeed(effectSpeed);
strip.setBrightness(255); strip.setBrightness(255);
strip.start(); strip.start();
@ -279,3 +276,46 @@ void initCon()
} }
} }
void buildCssColorString()
{
cssColorString=":root{--aCol:";
cssColorString+=cssCol[0];
cssColorString+=";--bCol:";
cssColorString+=cssCol[1];
cssColorString+=";--cCol:";
cssColorString+=cssCol[2];
cssColorString+=";--dCol:";
cssColorString+=cssCol[3];
cssColorString+=";--sCol:";
cssColorString+=cssCol[4];
cssColorString+=";}";
}
void serveIndex()
{
if (!arlsTimeout) //do not serve while receiving realtime
{
server.setContentLength(strlen_P(PAGE_index0) + cssColorString.length() + strlen_P(PAGE_index1) + strlen_P(PAGE_index2) + strlen_P(PAGE_index3));
server.send(200, "text/html", "");
server.sendContent_P(PAGE_index0);
server.sendContent(cssColorString);
server.sendContent_P(PAGE_index1);
server.sendContent_P(PAGE_index2);
server.sendContent_P(PAGE_index3);
} else {
server.send(200, "text/plain", "The WLED UI is not available while receiving real-time data.");
}
}
void serveWelcomePage()
{
String resp = "";
resp += PAGE_welcome0;
resp += cssColorString;
resp += PAGE_welcome1;
server.send(200, "text/html", resp);
}

View File

@ -2,6 +2,8 @@
* UDP notifier * UDP notifier
*/ */
#define WLEDPACKETSIZE 24
void notify(uint8_t callMode) void notify(uint8_t callMode)
{ {
if (!udpConnected) return; if (!udpConnected) return;
@ -13,7 +15,7 @@ void notify(uint8_t callMode)
case 6: if (!notifyDirect) return; break; //fx change case 6: if (!notifyDirect) return; break; //fx change
default: return; default: return;
} }
byte udpOut[16]; byte udpOut[WLEDPACKETSIZE];
udpOut[0] = 0; //0: wled notifier protocol 1: WARLS protocol udpOut[0] = 0; //0: wled notifier protocol 1: WARLS protocol
udpOut[1] = callMode; udpOut[1] = callMode;
udpOut[2] = bri; udpOut[2] = bri;
@ -25,17 +27,18 @@ void notify(uint8_t callMode)
udpOut[8] = effectCurrent; udpOut[8] = effectCurrent;
udpOut[9] = effectSpeed; udpOut[9] = effectSpeed;
udpOut[10] = white; udpOut[10] = white;
udpOut[11] = 2; //compatibilityVersionByte: 0: old 1: supports white 2: supports secondary color udpOut[11] = 3; //compatibilityVersionByte: 0: old 1: supports white 2: supports secondary color 3: supports FX intensity, 24 byte packet
udpOut[12] = col_sec[0]; udpOut[12] = col_sec[0];
udpOut[13] = col_sec[1]; udpOut[13] = col_sec[1];
udpOut[14] = col_sec[2]; udpOut[14] = col_sec[2];
udpOut[15] = white_sec; udpOut[15] = white_sec;
udpOut[16] = effectIntensity;
IPAddress broadcastIp; IPAddress broadcastIp;
broadcastIp = ~WiFi.subnetMask() | WiFi.gatewayIP(); broadcastIp = ~WiFi.subnetMask() | WiFi.gatewayIP();
notifierUdp.beginPacket(broadcastIp, udpPort); notifierUdp.beginPacket(broadcastIp, udpPort);
notifierUdp.write(udpOut, 16); notifierUdp.write(udpOut, WLEDPACKETSIZE);
notifierUdp.endPacket(); notifierUdp.endPacket();
} }
@ -72,6 +75,11 @@ void handleNotifications()
effectSpeed = udpIn[9]; effectSpeed = udpIn[9];
strip.setSpeed(effectSpeed); strip.setSpeed(effectSpeed);
} }
if (udpIn[11] > 3 && udpIn[16] != effectIntensity)
{
effectSpeed = udpIn[16];
strip.setIntensity(effectIntensity);
}
nightlightActive = udpIn[6]; nightlightActive = udpIn[6];
if (!nightlightActive) if (!nightlightActive)
{ {

4
wled00/wled15_hue.ino Normal file
View File

@ -0,0 +1,4 @@
/*
* Sync to Philips hue lights
*/
void foo(){}