WLED/wled00/data/settings_leds.htm

330 lines
14 KiB
HTML
Raw Normal View History

2020-05-17 20:09:39 +02:00
<!DOCTYPE html>
<html lang="en">
2020-05-17 20:09:39 +02:00
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=500">
<title>LED Settings</title>
<script>
var d=document,laprev=55;
function H()
{
window.open("https://github.com/Aircoookie/WLED/wiki/Settings#led-settings");
}
function B()
{
window.open("/settings","_self");
}
function S(){GetV();setABL();}
function enABL()
{
var en = d.getElementById('able').checked;
d.Sf.LA.value = (en) ? laprev:0;
d.getElementById('abl').style.display = (en) ? 'inline':'none';
d.getElementById('psu2').style.display = (en) ? 'inline':'none';
if (d.Sf.LA.value > 0) setABL();
}
function enLA()
{
var val = d.Sf.LAsel.value;
d.Sf.LA.value = val;
d.getElementById('LAdis').style.display = (val == 50) ? 'inline':'none';
UI();
}
function setABL()
{
d.getElementById('able').checked = true;
d.Sf.LAsel.value = 50;
switch (parseInt(d.Sf.LA.value)) {
case 0: d.getElementById('able').checked = false; enABL(); break;
case 30: d.Sf.LAsel.value = 30; break;
case 35: d.Sf.LAsel.value = 35; break;
case 55: d.Sf.LAsel.value = 55; break;
case 255: d.Sf.LAsel.value = 255; break;
default: d.getElementById('LAdis').style.display = 'inline';
}
UI();
}
function UI()
{
var myC = d.querySelectorAll('.wc'),
l = myC.length;
for (i = 0; i < l; i++) {
myC[i].style.display = (d.getElementById('rgbw').checked) ? 'inline':'none';
}
d.getElementById('ampwarning').style.display = (d.Sf.MA.value > 7200) ? 'inline':'none';
2021-01-17 00:20:31 +01:00
if (d.Sf.LA.value == 255) laprev = 12;
else if (d.Sf.LA.value > 0) laprev = d.Sf.LA.value;
var s = d.getElementsByTagName("select");
for (i=0; i<s.length; i++) {
if (s[i].name.substring(0,5)=="LTsel") {
n=s[i].name.substring(5);
d.getElementsByName("EW"+n)[0].checked = (parseInt(s[i].value)==30||parseInt(s[i].value)==54); // TYPE_xxxx values from const.h
var LK = d.getElementsByName("LK"+n)[0];
var o = d.getElementsByName("iLK");
n=(n==""?0:parseInt(n,10));
if (s[i].value>49 && s[i].value!=54) // TYPE_xxxx values from const.h
{
o[n].style = "display:inline;";
LK.required = true;
} else {
o[n].style = "display:none;";
LK.required = false;
LK.value="";
}
}
}
var LCs = d.getElementsByTagName("input");
var sLC = 0;
for (i=0; i<LCs.length; i++) {
var nm = LCs[i].name.substring(0,2);
if (nm=="LC") {sLC+=parseInt(LCs[i].value,10);continue;}
if (nm=="LP") {var lc=d.getElementsByName("LC"+LCs[i].name.substring(2))[0]; if(LCs[i].value==3) lc.max=500; else lc.max=1500;}
if (nm=="LP" || nm=="LK" || nm=="RL" || nm=="BT" || nm=="IR" || nm=="AX")
if (LCs[i].value!="" && LCs[i].value!="-1") {
if (d.um_p && d.um_p.some((e)=>e==parseInt(LCs[i].value,10))) {alert("Usermod pin clash!");LCs[i].value="";LCs[i].focus();continue;}
for (j=0; j<LCs.length; j++)
{
if (i==j) continue;
var n2 = LCs[j].name.substring(0,2);
if (n2=="LP" || n2=="LK" || n2=="RL" || n2=="BT" || n2=="IR" || n2=="AX")
if (LCs[j].value!="" && LCs[i].value==LCs[j].value) {alert("Pin clash!");LCs[i].value="";LCs[i].focus();break;}
}
}
}
d.getElementById('ledwarning').style.display = (sLC > 1000) ? 'inline':'none';
//var val = Math.ceil((100 + d.Sf.LC.value * laprev)/500)/2;
var val = Math.ceil((100 + sLC * laprev)/500)/2;
2020-05-17 20:09:39 +02:00
val = (val > 5) ? Math.ceil(val) : val;
var s = "";
var is12V = (d.Sf.LAsel.value == 30);
var isWS2815 = (d.Sf.LAsel.value == 255);
if (val < 1.02 && !is12V && !isWS2815)
{
s = "ESP 5V pin with 1A USB supply";
} else
{
s += is12V ? "12V ": isWS2815 ? "WS2815 12V " : "5V ";
s += val;
s += "A supply connected to LEDs";
}
var val2 = Math.ceil((100 + d.Sf.LC.value * laprev)/1500)/2;
val2 = (val2 > 5) ? Math.ceil(val2) : val2;
var s2 = "(for most effects, ~";
s2 += val2;
s2 += "A is enough)<br>";
d.getElementById('psu').innerHTML = s;
d.getElementById('psu2').innerHTML = isWS2815 ? "" : s2;
2021-01-17 00:20:31 +01:00
}
function addLEDs(n)
{
if (n>1) {d.maxST=n; d.getElementById("+").style="display:inline;"; return;}
var o = d.getElementsByName("iST");
var i = o.length;
if ((n==1 && i>=d.maxST) || (n==-1 && i<=1)) return;
var f = d.getElementById("mLC");
if (n==1) {
var s, t = d.createElement("div");
t.setAttribute("name","iST");
t.appendChild(d.createTextNode((i+1)+": "));
s = d.createElement("select");
s.setAttribute("name","LTsel"+i);
s.onchange = function(){UI()}
o = d.createElement("option"); o.text = "WS281x"; o.value = "22"; s.add(o);
o = d.createElement("option"); o.text = "SK6812"; o.value = "30"; s.add(o);
o = d.createElement("option"); o.text = "WS2801"; o.value = "50"; s.add(o);
o = d.createElement("option"); o.text = "APA102"; o.value = "51"; s.add(o);
o = d.createElement("option"); o.text = "LPD8806"; o.value = "52"; s.add(o);
o = d.createElement("option"); o.text = "P9813"; o.value = "53"; s.add(o);
o = d.createElement("option"); o.text = "TM1814"; o.value = "54"; s.add(o);
t.appendChild(s);
t.appendChild(d.createTextNode(" CO: "));
s = d.createElement("select");
s.setAttribute("name","CO"+i);
o = d.createElement("option"); o.text = "GRB"; o.value = "0"; s.add(o);
o = d.createElement("option"); o.text = "RGB"; o.value = "1"; s.add(o);
o = d.createElement("option"); o.text = "BRG"; o.value = "2"; s.add(o);
o = d.createElement("option"); o.text = "RBG"; o.value = "3"; s.add(o);
o = d.createElement("option"); o.text = "BGR"; o.value = "4"; s.add(o);
o = d.createElement("option"); o.text = "GBR"; o.value = "5"; s.add(o);
t.appendChild(s);
t.appendChild(d.createTextNode(" RGBW: "));
s = d.createElement("input");
s.type = "checkbox";
s.setAttribute("name","EW"+i);
t.appendChild(s);
t.appendChild(d.createElement("br"));
t.appendChild(d.createTextNode("pin:"));
var e = d.createElement("input");
e.type = "number"; e.value = ""; e.name = "LP"+i; e.min=0; e.max=40; e.required=true; e.onchange=function(){UI()};
t.appendChild(e);
var b = d.createElement("div");
b.setAttribute("name","iLK");
b.appendChild(d.createTextNode(" clk:"));
e = d.createElement("input");
e.type = "number"; e.value = ""; e.name = "LK"+i; e.min=0; e.max=40; e.onchange=function(){UI()};
if (d.getElementsByName("LTsel")[0].value>49) e.required = true;
b.appendChild(e);
t.appendChild(b);
t.appendChild(d.createTextNode(" count:"));
e = d.createElement("input");
e.type = "number"; e.value = "0"; e.name = "LC"+i; e.min=0; e.max=1000; e.required=true; e.oninput = function(){UI()};
t.appendChild(e);
t.appendChild(d.createElement("br"));
f.appendChild(t);
}
if (n==-1) {
o[--i].remove();--i;
}
var p = d.getElementById("+");
var m = d.getElementById("-");
if (i<d.maxST-1) {p.style="display:inline";} else {p.style="display:none";}
if (i>0) {m.style="display:inline";} else {m.style="display:none";}
UI();
}
2020-05-17 20:09:39 +02:00
function GetV()
{
2021-01-17 00:20:31 +01:00
//values injected by server while sending HTML
}
2020-05-17 20:09:39 +02:00
</script>
<style>
@import url("style.css");
2020-05-17 20:09:39 +02:00
</style>
</head>
<body onload="S()">
<form id="form_s" name="Sf" method="post">
<div class="helpB"><button type="button" onclick="H()">?</button></div>
<button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
2021-01-17 00:20:31 +01:00
<h2>LED &amp; HW setup</h2>
LED strips
<button type="button" id="+" onclick="addLEDs(1)" style="display:none;">+</button><button type="button" id="-" onclick="addLEDs(-1)" style="display:none;">-</button><br>
<div id="mLC">
<div name="iST">
1:
<select name="LTsel" onchange="UI()">
<option value="22">WS281x</option><!--TYPE_WS2812_RGB-->
<option value="30">SK6812</option><!--TYPE_WS2812_RGB-->
<option value="50">WS2801</option><!--TYPE_WS2801-->
<option value="51">APA102</option><!--TYPE_APA102-->
<option value="52">LPD8806</option><!--TYPE_LPD8806-->
<option value="53">P9813</option><!--TYPE_P9813-->
<option value="54">TM1814</option><!--TYPE_TM1814-->
</select>
CO:
<select name="CO">
<option value=0>GRB</option>
<option value=1>RGB</option>
<option value=2>BRG</option>
<option value=3>RBG</option>
<option value=4>BGR</option>
<option value=5>GBR</option>
</select>
RGBW: <input type="checkbox" name="EW" onchange=UI() id="rgbw"><br>
pin:<input name="LP" type="number" min="0" max="40" required onchange="UI()">
<div name="iLK" style="display:inline;">clk:<input name="LK" type="number" min="0" max="40" onchange="UI()"></div>
count:<input name="LC" type="number" min="1" max="1500" oninput="UI()" required>
</div>
</div><hr>
Relay pin: <input type="number" min="-1" max="40" name="RL" onchange="UI()"> Active high? <input type="checkbox" name="RM"><br>
Button pin: <input type="number" min="-1" max="40" name="BT" onchange="UI()"><br>
IR pin: <input type="number" min="-1" max="40" name="IR" onchange="UI()"><br>
AUX pin: <input type="number" min="-1" max="40" name="AX" onchange="UI()"><hr>
2020-05-17 20:09:39 +02:00
<div id="ledwarning" style="color: orange; display: none;">
&#9888; You might run into stability or lag issues.<br>
Use less than 1000 LEDs per ESP for the best experience!<br>
2021-01-17 00:20:31 +01:00
</div>
2020-05-17 20:09:39 +02:00
<i>Recommended power supply for brightest white:</i><br>
<b><span id="psu">?</span></b><br>
<span id="psu2"><br></span>
<br>
Enable automatic brightness limiter: <input type="checkbox" name="ABen" onchange="enABL()" id="able"><br>
<div id="abl">
Maximum Current: <input name="MA" type="number" min="250" max="65000" oninput="UI()" required> mA<br>
<div id="ampwarning" style="color: orange; display: none;">
&#9888; Your power supply provides high current.<br>
To improve the safety of your setup,<br>
please use thick cables,<br>
multiple power injection points and a fuse!<br>
</div>
<i>Automatically limits brightness to stay close to the limit.<br>
Keep at &lt;1A if powering LEDs directly from the ESP 5V pin!<br>
If you are using an external power supply, enter its rating.<br>
(Current estimated usage: <span class="pow">unknown</span>)</i><br><br>
LED voltage (Max. current for a single LED):<br>
<select name="LAsel" onchange="enLA()">
<option value="55" selected>5V default (55mA)</option>
<option value="35">5V efficient (35mA)</option>
<option value="30">12V (30mA)</option>
<option value="255">WS2815 (12mA)</option>
<option value="50">Custom</option>
</select><br>
<span id="LAdis" style="display: none;">Custom max. current per LED: <input name="LA" type="number" min="0" max="255" id="la" oninput="UI()" required> mA<br></span>
<i>Keep at default if you are unsure about your type of LEDs.</i><br>
</div>
<br>
<span class="wc">
Auto-calculate white channel from RGB:<br>
2021-01-17 00:20:31 +01:00
<select name="AW">
<option value=0>None</option>
<option value=1>Brighter</option>
<option value=2>Accurate</option>
<option value=3>Dual</option>
<option value=4>Legacy</option>
</select>
<br></span>
2020-05-17 20:09:39 +02:00
<h3>Defaults</h3>
Turn LEDs on after power up/reset: <input type="checkbox" name="BO"><br>
Default brightness: <input name="CA" type="number" min="0" max="255" required> (0-255)<br><br>
Apply preset <input name="BP" type="number" min="0" max="250" required> at boot (0 uses defaults)
2020-05-17 20:09:39 +02:00
<br>- <i>or</i> -<br>
Set current preset cycle setting as boot default: <input type="checkbox" name="PC"><br><br>
Use Gamma correction for color: <input type="checkbox" name="GC"> (strongly recommended)<br>
Use Gamma correction for brightness: <input type="checkbox" name="GB"> (not recommended)<br><br>
Brightness factor: <input name="BF" type="number" min="1" max="255" required> %
<h3>Transitions</h3>
Crossfade: <input type="checkbox" name="TF"><br>
Transition Time: <input name="TD" maxlength="5" size="2"> ms<br>
Enable Palette transitions: <input type="checkbox" name="PF">
<h3>Timed light</h3>
Default Duration: <input name="TL" type="number" min="1" max="255" required> min<br>
Default Target brightness: <input name="TB" type="number" min="0" max="255" required><br>
Mode:
<select name="TW">
<option value="0">Wait and set</option>
<option value="1">Fade</option>
<option value="2">Fade Color</option>
<option value="3">Sunrise</option>
</select>
2020-05-17 20:09:39 +02:00
<h3>Advanced</h3>
Palette blending:
<select name="PB">
<option value="0">Linear (wrap if moving)</option>
<option value="1">Linear (always wrap)</option>
<option value="2">Linear (never wrap)</option>
<option value="3">None (not recommended)</option>
</select><br>
Reverse LED order (rotate 180): <input type="checkbox" name="RV"><br>
2021-01-17 00:20:31 +01:00
Skip first LED: <input type="checkbox" name="SL"><hr>
2020-05-17 20:09:39 +02:00
<button type="button" onclick="B()">Back</button><button type="submit">Save</button>
</form>
</body>
</html>