mirror of
https://github.com/wled/WLED.git
synced 2025-07-17 15:56:31 +00:00
parent
1b0ce9a123
commit
407477dc68
@ -119,7 +119,12 @@
|
|||||||
var en = d.Sf.ABL.checked;
|
var en = d.Sf.ABL.checked;
|
||||||
gId('abl').style.display = (en) ? 'inline':'none';
|
gId('abl').style.display = (en) ? 'inline':'none';
|
||||||
gId('psu2').style.display = (en) ? 'inline':'none';
|
gId('psu2').style.display = (en) ? 'inline':'none';
|
||||||
if (!en) d.Sf.PPL.checked = false;
|
if (!en) {
|
||||||
|
// limiter disabled
|
||||||
|
d.Sf.PPL.checked = false;
|
||||||
|
// d.Sf.querySelectorAll("#mLC select[name^=LAsel]").forEach((e)=>{e.selectedIndex = 0;}); // select default LED mA
|
||||||
|
// d.Sf.querySelectorAll("#mLC input[name^=LA]").forEach((e)=>{e.min = 0; e.value = 0;}); // set min & value to 0
|
||||||
|
}
|
||||||
UI();
|
UI();
|
||||||
}
|
}
|
||||||
// enable per port limiter and calculate current
|
// enable per port limiter and calculate current
|
||||||
@ -132,37 +137,41 @@
|
|||||||
d.Sf.MA.min = abl && !ppl ? 250 : 0;
|
d.Sf.MA.min = abl && !ppl ? 250 : 0;
|
||||||
gId("psuMA").style.display = ppl ? 'none' : 'inline';
|
gId("psuMA").style.display = ppl ? 'none' : 'inline';
|
||||||
gId("ppldis").style.display = ppl ? 'inline' : 'none';
|
gId("ppldis").style.display = ppl ? 'inline' : 'none';
|
||||||
// set PPL minimum value and clear actual PPL limit if ABL disabled
|
// set PPL minimum value and clear actual PPL limit if ABL is disabled
|
||||||
d.Sf.querySelectorAll("#mLC input[name^=MA]").forEach((i,x)=>{
|
d.Sf.querySelectorAll("#mLC input[name^=MA]").forEach((i,x)=>{
|
||||||
var n = String.fromCharCode((x<10?48:55)+x);
|
var n = String.fromCharCode((x<10?48:55)+x);
|
||||||
gId("PSU"+n).style.display = ppl ? "inline" : "none";
|
gId("PSU"+n).style.display = ppl ? "inline" : "none";
|
||||||
const t = parseInt(d.Sf["LT"+n].value); // LED type SELECT
|
const t = parseInt(d.Sf["LT"+n].value); // LED type SELECT
|
||||||
const c = parseInt(d.Sf["LC"+n].value); //get LED count
|
const c = parseInt(d.Sf["LC"+n].value); //get LED count
|
||||||
i.min = ppl && !(isVir(t) || isAna(t)) ? 250 : 0;
|
i.min = ppl && isDig(t) ? 250 : 0;
|
||||||
if (!abl || isVir(t) || isAna(t)) i.value = 0;
|
if (!abl || !isDig(t)) i.value = 0;
|
||||||
else if (ppl) sumMA += parseInt(i.value,10);
|
else if (ppl) sumMA += parseInt(i.value,10);
|
||||||
else if (sDI) i.value = Math.round(parseInt(d.Sf.MA.value,10)*c/sDI);
|
else if (sDI) i.value = Math.round(parseInt(d.Sf.MA.value,10)*c/sDI);
|
||||||
});
|
});
|
||||||
if (ppl) d.Sf.MA.value = sumMA; // populate UI ABL value if PPL used
|
if (ppl) d.Sf.MA.value = sumMA; // populate UI ABL value if PPL used
|
||||||
}
|
}
|
||||||
|
// enable and update LED Amps
|
||||||
function enLA(s,n)
|
function enLA(s,n)
|
||||||
{
|
{
|
||||||
|
const abl = d.Sf.ABL.checked;
|
||||||
const t = parseInt(d.Sf["LT"+n].value); // LED type SELECT
|
const t = parseInt(d.Sf["LT"+n].value); // LED type SELECT
|
||||||
gId('LAdis'+n).style.display = s.selectedIndex==5 ? "inline" : "none";
|
gId('LAdis'+n).style.display = s.selectedIndex==5 ? "inline" : "none"; // show/hide custom mA field
|
||||||
if (s.value!=="0") d.Sf["LA"+n].value = s.value;
|
if (s.value!=="0") d.Sf["LA"+n].value = s.value; // set value from select object
|
||||||
d.Sf["LA"+n].min = (isVir(t) || isAna(t)) ? 0 : 1;
|
d.Sf["LA"+n].min = (!isDig(t) || !abl) ? 0 : 1; // set minimum value for validation
|
||||||
}
|
}
|
||||||
function setABL()
|
function setABL()
|
||||||
{
|
{
|
||||||
d.Sf.ABL.checked = parseInt(d.Sf.MA.value) > 0;
|
let en = parseInt(d.Sf.MA.value) > 0;
|
||||||
// check if ABL is enabled (max mA entered per output)
|
// check if ABL is enabled (max mA entered per output)
|
||||||
d.Sf.querySelectorAll("#mLC input[name^=MA]").forEach((i,n)=>{
|
d.Sf.querySelectorAll("#mLC input[name^=MA]").forEach((i,n)=>{
|
||||||
if (parseInt(i.value) > 0) d.Sf.ABL.checked = true;
|
if (parseInt(i.value) > 0) en = true;
|
||||||
});
|
});
|
||||||
|
d.Sf.ABL.checked = en;
|
||||||
// select appropriate LED current
|
// select appropriate LED current
|
||||||
d.Sf.querySelectorAll("#mLC select[name^=LAsel]").forEach((sel,x)=>{
|
d.Sf.querySelectorAll("#mLC select[name^=LAsel]").forEach((sel,x)=>{
|
||||||
sel.value = 0; // set custom
|
sel.value = 0; // set custom
|
||||||
var n = String.fromCharCode((x<10?48:55)+x);
|
var n = String.fromCharCode((x<10?48:55)+x);
|
||||||
|
if (en)
|
||||||
switch (parseInt(d.Sf["LA"+n].value)) {
|
switch (parseInt(d.Sf["LA"+n].value)) {
|
||||||
case 0: break; // disable ABL
|
case 0: break; // disable ABL
|
||||||
case 15: sel.value = 15; break;
|
case 15: sel.value = 15; break;
|
||||||
@ -171,7 +180,8 @@
|
|||||||
case 55: sel.value = 55; break;
|
case 55: sel.value = 55; break;
|
||||||
case 255: sel.value = 255; break;
|
case 255: sel.value = 255; break;
|
||||||
}
|
}
|
||||||
enLA(sel,n);
|
else sel.value = 0;
|
||||||
|
enLA(sel,n); // configure individual limiter
|
||||||
});
|
});
|
||||||
enABL();
|
enABL();
|
||||||
gId('m1').innerHTML = maxM;
|
gId('m1').innerHTML = maxM;
|
||||||
@ -202,7 +212,7 @@
|
|||||||
let gRGBW = false, memu = 0;
|
let gRGBW = false, memu = 0;
|
||||||
let busMA = 0;
|
let busMA = 0;
|
||||||
let sLC = 0, sPC = 0, sDI = 0, maxLC = 0;
|
let sLC = 0, sPC = 0, sDI = 0, maxLC = 0;
|
||||||
const ablEN = d.Sf.ABL.checked;
|
const abl = d.Sf.ABL.checked;
|
||||||
maxB = oMaxB; // TODO make sure we start with all possible buses
|
maxB = oMaxB; // TODO make sure we start with all possible buses
|
||||||
let setPinConfig = (n,t) => {
|
let setPinConfig = (n,t) => {
|
||||||
let p0d = "GPIO:";
|
let p0d = "GPIO:";
|
||||||
@ -249,12 +259,12 @@
|
|||||||
var t = parseInt(s.value);
|
var t = parseInt(s.value);
|
||||||
memu += getMem(t, n); // calc memory
|
memu += getMem(t, n); // calc memory
|
||||||
setPinConfig(n,t);
|
setPinConfig(n,t);
|
||||||
gId("abl"+n).style.display = (!ablEN || isVir(t) || isAna(t)) ? "none" : "inline";
|
gId("abl"+n).style.display = (!abl || !isDig(t)) ? "none" : "inline"; // show/hide individual ABL settings
|
||||||
if (change) {
|
if (change) { // did we change LED type?
|
||||||
gId("rf"+n).checked = (gId("rf"+n).checked || t == 31); // LEDs require data in off state (mandatory for TM1814)
|
gId("rf"+n).checked = (gId("rf"+n).checked || t == 31); // LEDs require data in off state (mandatory for TM1814)
|
||||||
if (isAna(t)) d.Sf["LC"+n].value = 1; // for sanity change analog count just to 1 LED
|
if (isAna(t)) d.Sf["LC"+n].value = 1; // for sanity change analog count just to 1 LED
|
||||||
d.Sf["LA"+n].min = (isVir(t) || isAna(t)) ? 0 : 1;
|
d.Sf["LA"+n].min = (!isDig(t) || !abl) ? 0 : 1; // set minimum value for LED mA
|
||||||
d.Sf["MA"+n].min = (isVir(t) || isAna(t)) ? 0 : 250;
|
d.Sf["MA"+n].min = (!isDig(t)) ? 0 : 250; // set minimum value for PSU mA
|
||||||
}
|
}
|
||||||
gId("rf"+n).onclick = mustR(t) ? (()=>{return false}) : (()=>{}); // prevent change change of "Refresh" checkmark when mandatory
|
gId("rf"+n).onclick = mustR(t) ? (()=>{return false}) : (()=>{}); // prevent change change of "Refresh" checkmark when mandatory
|
||||||
gRGBW |= hasW(t); // RGBW checkbox
|
gRGBW |= hasW(t); // RGBW checkbox
|
||||||
@ -294,7 +304,7 @@
|
|||||||
if (s+c > sLC) sLC = s+c; //update total count
|
if (s+c > sLC) sLC = s+c; //update total count
|
||||||
if (c > maxLC) maxLC = c; //max per output
|
if (c > maxLC) maxLC = c; //max per output
|
||||||
if (!isVir(t)) sPC += c; //virtual out busses do not count towards physical LEDs
|
if (!isVir(t)) sPC += c; //virtual out busses do not count towards physical LEDs
|
||||||
if (!(isVir(t) || isAna(t))) {
|
if (isDig(t)) {
|
||||||
sDI += c; // summarize digital LED count
|
sDI += c; // summarize digital LED count
|
||||||
let maPL = parseInt(d.Sf["LA"+n].value);
|
let maPL = parseInt(d.Sf["LA"+n].value);
|
||||||
if (maPL == 255) maPL = 12;
|
if (maPL == 255) maPL = 12;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user