diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 0900be399..d7a4d1552 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -24,6 +24,7 @@ function is16b(t) { return !!(gT(t).c & 0x10); } // is digital 16 bit type function mustR(t) { return !!(gT(t).c & 0x20); } // Off refresh is mandatory function numPins(t){ return Math.max(gT(t).t.length, 1); } // type length determines number of GPIO pins + function chrID(x) { return String.fromCharCode((x<10?48:55)+x); } function S() { getLoc(); loadJS(getURL('/settings/s.js?p=2'), false, ()=>{ @@ -138,7 +139,7 @@ gId("ppldis").style.display = ppl ? 'inline' : 'none'; // set PPL minimum value and clear actual PPL limit if ABL is disabled d.Sf.querySelectorAll("#mLC input[name^=MA]").forEach((i,x)=>{ - var n = String.fromCharCode((x<10?48:55)+x); + var n = chrID(x); gId("PSU"+n).style.display = ppl ? "inline" : "none"; const t = parseInt(d.Sf["LT"+n].value); // LED type SELECT const c = parseInt(d.Sf["LC"+n].value); //get LED count @@ -169,7 +170,7 @@ // select appropriate LED current d.Sf.querySelectorAll("#mLC select[name^=LAsel]").forEach((sel,x)=>{ sel.value = 0; // set custom - var n = String.fromCharCode((x<10?48:55)+x); + var n = chrID(x); if (en) switch (parseInt(d.Sf["LA"+n].value)) { case 0: break; // disable ABL @@ -399,7 +400,7 @@ } function lastEnd(i) { if (i-- < 1) return 0; - var s = String.fromCharCode((i<10?48:55)+i); + var s = chrID(i); v = parseInt(d.getElementsByName("LS"+s)[0].value) + parseInt(d.getElementsByName("LC"+s)[0].value); var t = parseInt(d.getElementsByName("LT"+s)[0].value); if (isPWM(t)) v = 1; //PWM busses @@ -422,7 +423,7 @@ }); if ((n==1 && i>=maxB+maxV) || (n==-1 && i==0)) return; - var s = String.fromCharCode((i<10?48:55)+i); + var s = chrID(i); if (n==1) { // npm run build has trouble minimizing spaces inside string @@ -506,7 +507,7 @@ mA/LED:   @@ -560,7 +561,7 @@ Swap: `; c += `  function checkSi() { //on load, checks whether there are custom start fields var cs = false; for (var i=1; i < gEBCN("iST").length; i++) { - var v = parseInt(gId("ls"+(i-1)).value) + parseInt(gN("LC"+(i-1)).value); - if (v != parseInt(gId("ls"+i).value)) {cs = true; startsDirty[i] = true;} + var s = chrID(i); + var p = chrID(i-1); // cover edge case 'A' previous char being '9' + var v = parseInt(gId("ls"+p).value) + parseInt(gN("LC"+p).value); + if (v != parseInt(gId("ls"+s).value)) {cs = true; startsDirty[i] = true;} } if (gId("ls0") && parseInt(gId("ls0").value) != 0) {cs = true; startsDirty[0] = true;} gId("si").checked = cs; @@ -617,7 +620,7 @@ Swap: