Pin clash fix, minimization.

This commit is contained in:
Blaž Kristan 2021-02-25 13:22:29 +01:00
parent 2812f61957
commit 3f41ba6bdf
2 changed files with 74 additions and 75 deletions

View File

@ -86,7 +86,7 @@
} }
function UI(change=false) function UI(change=false)
{ {
var isRGBW = false, memu = 0, p3u = false, lCount = 0; var isRGBW = false, memu = 0, p3u = false;
d.getElementById('ampwarning').style.display = (d.Sf.MA.value > 7200) ? 'inline':'none'; d.getElementById('ampwarning').style.display = (d.Sf.MA.value > 7200) ? 'inline':'none';
@ -157,7 +157,7 @@
if (i==j) continue; if (i==j) continue;
var n2 = LCs[j].name.substring(0,2); var n2 = LCs[j].name.substring(0,2);
if (n2=="L0" || n2=="L1" || n2=="L2" || n2=="L3" || n2=="L4" || n2=="RL" || n2=="BT" || n2=="IR" || n2=="AX") if (n2=="L0" || n2=="L1" || n2=="L2" || n2=="L3" || n2=="L4" || 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;} if (LCs[j].value!="" && LCs[i].value==LCs[j].value) {alert("Pin clash!");LCs[j].value="";LCs[j].focus();break;}
} }
} }
} }
@ -212,47 +212,46 @@
var f = d.getElementById("mLC"); var f = d.getElementById("mLC");
if (n==1) { if (n==1) {
// npm run build has trouble minimizing spaces inside string // npm run build has trouble minimizing spaces inside string
var cn = var cn = '<div class="iST">'+
`<div class="iST"> i>0?'<hr style="width:260px">':''+
${i>0?'<hr style="width:260px">':''} i+1 + ':'+
${i+1}: `<select name="LT${i}" onchange="UI(true)">`+
<select name="LT${i}" onchange="UI(true)"> '<option value="22">WS281x</option>'+
<option value="22">WS281x</option> '<option value="30">SK6812 RGBW</option>'+
<option value="30">SK6812 RGBW</option> '<option value="31">TM1814</option>'+
<option value="31">TM1814</option> '<option value="24">400kHz</option>'+
<option value="24">400kHz</option> '<option value="50">WS2801</option>'+
<option value="50">WS2801</option> '<option value="51">APA102</option>'+
<option value="51">APA102</option> '<option value="52">LPD8806</option>'+
<option value="52">LPD8806</option> '<option value="53">P9813</option>'+
<option value="53">P9813</option> '<option value="41">PWM White</option>'+
<option value="41">PWM White</option> '<option value="42">PWM WWCW</option>'+
<option value="42">PWM WWCW</option> '<option value="43">PWM RGB</option>'+
<option value="43">PWM RGB</option> '<option value="44">PWM RGBW</option>'+
<option value="44">PWM RGBW</option> '<option value="45">PWM RGBWC</option>'+
<option value="45">PWM RGBWC</option> '</select>&nbsp;'+
</select>&nbsp; 'Color Order:'+
Color Order: `<select name="CO${i}">`+
<select name="CO${i}"> '<option value="0">GRB</option>'+
<option value="0">GRB</option> '<option value="1">RGB</option>'+
<option value="1">RGB</option> '<option value="2">BRG</option>'+
<option value="2">BRG</option> '<option value="3">RBG</option>'+
<option value="3">RBG</option> '<option value="4">BGR</option>'+
<option value="4">BGR</option> '<option value="5">GBR</option>'+
<option value="5">GBR</option> '</select>&nbsp;'+
</select><!--br--> `RGBW: <input id="ew${i}" type="checkbox" name="EW${i}"><br>`+
RGBW: <input id="ew${i}" type="checkbox" name="EW${i}"><br> `<span id="p0d${i}">Pin: </span><input type="number" name="L0${i}" min="0" max="40" required style="width:35px" onchange="UI()"/>`+
<span id="p0d${i}">Pin:</span> <input type="number" name="L0${i}" min="0" max="40" required style="width:35px" onchange="UI()"/> `<span id="p1d${i}">Clock: </span><input type="number" name="L1${i}" min="0" max="40" style="width:35px" onchange="UI()"/>`+
<span id="p1d${i}">Clock:</span> <input type="number" name="L1${i}" min="0" max="40" style="width:35px" onchange="UI()"/> `<span id="p2d${i}"></span><input type="number" name="L2${i}" min="0" max="40" style="width:35px" onchange="UI()"/>`+
<span id="p2d${i}"></span><input type="number" name="L2${i}" min="0" max="40" style="width:35px" onchange="UI()"/> `<span id="p3d${i}"></span><input type="number" name="L3${i}" min="0" max="40" style="width:35px" onchange="UI()"/>`+
<span id="p3d${i}"></span><input type="number" name="L3${i}" min="0" max="40" style="width:35px" onchange="UI()"/> `<span id="p4d${i}"></span><input type="number" name="L4${i}" min="0" max="40" style="width:35px" onchange="UI()"/>`+
<span id="p4d${i}"></span><input type="number" name="L4${i}" min="0" max="40" style="width:35px" onchange="UI()"/> '<br>'+
<br> `<span id="psd${i}">Start:</span> <input type="number" name="LS${i}" id="ls${i}" min="0" max="8191" value="0" required />&nbsp;`+
<span id="psd${i}">Start:</span> <input type="number" name="LS${i}" id="ls${i}" min="0" max="8191" value="0" required />&nbsp; `<div id="dig${i}" style="display:inline">`+
<div id="dig${i}" style="display:inline"> `Count: <input type="number" name="LC${i}" min="0" max="2048" value="1" required oninput="UI()" /><br>`+
Count: <input type="number" name="LC${i}" min="0" max="2048" value="1" required oninput="UI()" /><br> `Reverse: <input type="checkbox" name="CV${i}"></div><br>`+
Reverse: <input type="checkbox" name="CV${i}"></div><br> '</div>';
</div>`;
f.insertAdjacentHTML("beforeend", cn); f.insertAdjacentHTML("beforeend", cn);
} }
if (n==-1) { if (n==-1) {
@ -279,35 +278,35 @@
<div class="helpB"><button type="button" onclick="H()">?</button></div> <div class="helpB"><button type="button" onclick="H()">?</button></div>
<button type="button" onclick="B()">Back</button><button type="button" onclick="trySubmit()">Save</button><hr> <button type="button" onclick="B()">Back</button><button type="button" onclick="trySubmit()">Save</button><hr>
<h2>LED &amp; Hardware setup</h2> <h2>LED &amp; Hardware setup</h2>
Total LED count: <input name="LC" id="LC" type="number" min="1" max="8192" oninput="UI()" required readonly><br> Total LED count: <input name="LC" id="LC" type="number" min="1" max="8192" oninput="UI()" size="4" required readonly><br>
<i>Recommended power supply for brightest white:</i><br> <i>Recommended power supply for brightest white:</i><br>
<b><span id="psu">?</span></b><br> <b><span id="psu">?</span></b><br>
<span id="psu2"><br></span> <span id="psu2"><br></span>
<br> <br>
Enable automatic brightness limiter: <input type="checkbox" name="ABen" onchange="enABL()" id="able"><br> Enable automatic brightness limiter: <input type="checkbox" name="ABen" onchange="enABL()" id="able"><br>
<div id="abl"> <div id="abl">
Maximum Current: <input name="MA" type="number" min="250" max="65000" oninput="UI()" required> mA<br> Maximum Current: <input name="MA" type="number" min="250" max="65000" oninput="UI()" required> mA<br>
<div id="ampwarning" style="color: orange; display: none;"> <div id="ampwarning" style="color: orange; display: none;">
&#9888; Your power supply provides high current.<br> &#9888; Your power supply provides high current.<br>
To improve the safety of your setup,<br> To improve the safety of your setup,<br>
please use thick cables,<br> please use thick cables,<br>
multiple power injection points and a fuse!<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> </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>
<h3>Hardware setup</h3> <h3>Hardware setup</h3>
<div id="mLC">LED outputs:</div> <div id="mLC">LED outputs:</div>
<button type="button" id="+" onclick="addLEDs(1)">+</button> <button type="button" id="+" onclick="addLEDs(1)">+</button>

File diff suppressed because one or more lines are too long