Skip to content

Commit 0e0e1ac

Browse files
committed
call updateTypeDropdowns() at end of UI(), bugfix
fixed bug that allowed to change to 2-pin digital and then back to 1-pin digital.
1 parent 025be3b commit 0e0e1ac

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

wled00/data/settings_leds.htm

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,6 @@
270270
let dC = 0; // count of digital buses (for parallel I2S)
271271
let LTs = d.Sf.querySelectorAll("#mLC select[name^=LT]");
272272
LTs.forEach((s,i)=>{
273-
s.addEventListener('change', updateTypeDropdowns);
274-
//if (i < LTs.length-1) s.disabled = true; // prevent changing type (as we can't update options)
275273
// is the field a LED type?
276274
var n = s.name.substring(2,3); // bus number (0-Z)
277275
var t = parseInt(s.value);
@@ -435,6 +433,8 @@
435433
gId('fpsNone').style.display = (d.Sf.FR.value == 0) ? 'block':'none';
436434
gId('fpsWarn').style.display = (d.Sf.FR.value == 0) || (d.Sf.FR.value >= 80) ? 'block':'none';
437435
gId('fpsHigh').style.display = (d.Sf.FR.value >= 80) ? 'block':'none';
436+
// restrict bus types in dropdowns to max allowed digital/analog buses
437+
updateTypeDropdowns();
438438
}
439439
function lastEnd(i) {
440440
if (i-- < 1) return 0;
@@ -524,7 +524,6 @@
524524

525525
if (!init) {
526526
UI();
527-
updateTypeDropdowns();
528527
}
529528
}
530529

@@ -726,7 +725,6 @@
726725
if (i.value!=="" && i.value>=0)
727726
i.dataset.val = i.value;
728727
});
729-
updateTypeDropdowns();
730728
}
731729
function pinUpd(e) {
732730
// update changed select options across all usermods
@@ -818,7 +816,7 @@
818816
// max digital count
819817
let maxDB = maxD - ((is32() || isS2() || isS3()) ? (!d.Sf["PR"].checked) * 8 - (!isS3()) : 0);
820818
// disallow adding more of a type that has reached its limit
821-
if (digitalB >= maxDB && !isDig(curType)) disable('option[data-type="D"]');
819+
if (digitalB >= maxDB && !(isDig(curType) && !isD2P(curType))) disable('option[data-type="D"]');
822820
if (twopinB >= 2 && !isD2P(curType)) disable('option[data-type="2P"]');
823821
disable(`option[data-type^="${'A'.repeat(maxA - analogB + (isPWM(curType)?numPins(curType):0) + 1)}"]`);
824822
});

0 commit comments

Comments
 (0)