Skip to content

Commit d89b7f9

Browse files
committed
bugfix: dont allow additional digital buses
1 parent 7ce356a commit d89b7f9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

wled00/data/settings_leds.htm

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,11 @@
514514
}
515515
});
516516
enLA(d.Sf["LAsel"+s],s); // update LED mA
517+
// temporarily set to virtual (network) type to avoid "same type" exception during dropdown update
518+
let sel = d.getElementsByName("LT"+s)[0];
519+
sel.value = sel.querySelector('option[data-type="N"]').value;
520+
updateTypeDropdowns(); // update valid bus options including this new one
521+
sel.selectedIndex = sel.querySelector('option:not(:disabled)').index;
517522
}
518523
if (n==-1) {
519524
o[--i].remove();--i;
@@ -813,11 +818,10 @@
813818
const disable = (q) => sel.querySelectorAll(q).forEach(o => o.disabled = true);
814819
const enable = (q) => sel.querySelectorAll(q).forEach(o => o.disabled = false);
815820
enable('option'); // reset all first
816-
// max digital count
817-
// 32 & S2 supports mono I2S as well as parallel so we need to take that into account; S3 only supports parallel
821+
// max digital buses: ESP32 & S2 support mono I2S as well as parallel so we need to take that into account; S3 only supports parallel
818822
// supported outputs using parallel I2S/mono I2S: S2: 12/5, S3: 12/4, ESP32: 16/9
819-
let maxDB = maxD - ((is32() || isS2() || isS3()) ? (!d.Sf["PR"].checked) * 8 - (!isS3()) : 0);
820-
// disallow adding more of a type that has reached its limit
823+
let maxDB = maxD - ((is32() || isS2() || isS3()) ? (!d.Sf["PR"].checked) * 8 - (!isS3()) : 0); // adjust max digital buses if parallel I2S is not used
824+
// disallow adding more of a type that has reached its limit but allow changing the current type
821825
if (digitalB >= maxDB && !(isDig(curType) && !isD2P(curType))) disable('option[data-type="D"]');
822826
if (twopinB >= 2 && !isD2P(curType)) disable('option[data-type="2P"]');
823827
disable(`option[data-type^="${'A'.repeat(maxA - analogB + (isPWM(curType)?numPins(curType):0) + 1)}"]`);

0 commit comments

Comments
 (0)