diff --git a/readme.md b/readme.md index 1e3ff935..e2eaceec 100644 --- a/readme.md +++ b/readme.md @@ -62,9 +62,10 @@ Add one or multiple of the following parameters after the base url to change val "&T=<0 or 1 or 2-255>" 0: switch off, on, toggle "&FX=<0-47>" set LED effect (refer to WS2812FX library) "&SX=<0-255>" set LED effect speed (refer to WS2812FX library) -"&NR=<0 or 1>" receive notifications on or off -"&NS=<0 or 1>" send (direct) notifications on or off +"&RN=<0 or 1>" receive notifications on or off +"&SN=<0 or 1>" send (direct) notifications on or off "&NL=<0 or 1>" turns nightlight function on or off +"&MD=<0 or 1>" sets client color picker mode (RGB/HSB) ("&OL=<0, 1, 3 or 5>" experimental clock overlays) ("&I=<0-255>" experimental individual LED control) ("&I=<0-255>&I2=<0-255>" experimental individual LED range control) diff --git a/wled00/data/button.png b/wled00/data/button.png deleted file mode 100644 index bb80729b..00000000 Binary files a/wled00/data/button.png and /dev/null differ diff --git a/wled00/data/index.htm b/wled00/data/index.htm index d7ab40d1..18023213 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -7,7 +7,13 @@ strG = ""; strB = ""; strNL = ""; + strNR = ""; + strNS = ""; var nla = false; + var nra = false; + var nsa = false; + var sto = false; + var hsb = false; function Startup() { @@ -28,6 +34,8 @@ document.Ctrl_form.SG.value = this.responseXML.getElementsByTagName('cl')[1].childNodes[0].nodeValue; document.Ctrl_form.SB.value = this.responseXML.getElementsByTagName('cl')[2].childNodes[0].nodeValue; nla = (this.responseXML.getElementsByTagName('nl')[0].innerHTML)!=0?true:false; + nra = (this.responseXML.getElementsByTagName('nr')[0].innerHTML)!=0?true:false; + nsa = (this.responseXML.getElementsByTagName('ns')[0].innerHTML)!=0?true:false; document.getElementsByClassName("desc")[0].innerHTML = this.responseXML.getElementsByTagName('desc')[0].innerHTML; UpdateVals(); } @@ -35,13 +43,15 @@ } } // send HTTP request - request.open("GET", "win/" + strA + strR + strG + strB + strNL + nocache, true); + request.open("GET", "win/" + strA + strR + strG + strB + strNL + strNR + strNS + nocache, true); request.send(null); strA = ""; strR = ""; strG = ""; strB = ""; strNL = ""; + strNR = ""; + strNS = ""; } function GetCheck() { @@ -63,15 +73,68 @@ function UpdateVals() { document.body.style.background = lingrad(Ctrl_form.SR.value, Ctrl_form.SG.value, Ctrl_form.SB.value); + setHS(Ctrl_form.SR.value, Ctrl_form.SG.value, Ctrl_form.SB.value); if (nla) { - nlb.style.fill="white"; + nlb.style.fill="green"; } else { nlb.style.fill="black"; } + if (nra) { + nrb.style.fill="green"; + } else { + nrb.style.fill="black"; + } + if (nsa) { + nsb.style.fill="green"; + } else { + nsb.style.fill="black"; + } + } + function ToggleHSB() + { + cdB.style.display="none"; + hsb = !hsb; + if (hsb) + { + document.getElementById("slR").style.display="none"; + document.getElementById("slG").style.display="none"; + document.getElementById("slB").style.display="none"; + document.getElementById("slH").style.display="block"; + document.getElementById("slS").style.display="block"; + mdb.style.fill="green"; + } else { + document.getElementById("slR").style.display="block"; + document.getElementById("slG").style.display="block"; + document.getElementById("slB").style.display="block"; + document.getElementById("slH").style.display="none"; + document.getElementById("slS").style.display="none"; + mdb.style.fill="black"; + } + cdB.style.display="inline"; } function OpenSettings() { - window.open("/settings","_self"); + sto = true; + stb.style.fill="green"; + cdB.style.display="none"; + stf.style.display="inline"; + stf.src="/settings"; + } + function CloseSettings() + { + sto = false; + stb.style.fill="black"; + cdB.style.display="inline"; + stf.style.display="none"; + } + function ToggleSettings() + { + if (sto) + { + CloseSettings(); + } else { + OpenSettings(); + } } function ToggleNl() { @@ -84,14 +147,88 @@ UpdateVals(); GetArduinoIO(); } + function ToggleNr() + { + nra = !nra; + if (nra) { + strNR="&RN=1"; + } else { + strNR="&RN=0"; + } + UpdateVals(); + GetArduinoIO(); + } + function ToggleNs() + { + nsa = !nsa; + if (nsa) { + strNS="&SN=1"; + } else { + strNS="&SN=0"; + } + UpdateVals(); + GetArduinoIO(); + } + function setHS() { + var rr, gg, bb, + r = arguments[0] / 255, + g = arguments[1] / 255, + b = arguments[2] / 255, + h, s, + v = Math.max(r, g, b), + diff = v - Math.min(r, g, b), + diffc = function(c){ + return (v - c) / 6 / diff + 1 / 2; + }; + + if (diff == 0) { + h = s = 0; + } else { + s = diff / v; + rr = diffc(r); + gg = diffc(g); + bb = diffc(b); + + if (r === v) { + h = bb - gg; + }else if (g === v) { + h = (1 / 3) + rr - bb; + }else if (b === v) { + h = (2 / 3) + gg - rr; + } + if (h < 0) { + h += 1; + }else if (h > 1) { + h -= 1; + } + } + document.Ctrl_form.SH.value = h; + document.Ctrl_form.SS.value = s; + } + function GetRGB() + { + var r, g, b, i, f, p, q, t; + var h = document.Ctrl_form.SH.value, s = document.Ctrl_form.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; break; + } + document.Ctrl_form.SR.value = r; + document.Ctrl_form.SG.value = g; + document.Ctrl_form.SB.value = b; + GetCheck(); + }
-