Allow "unlimited" virtual buses
- added config upload options - number of buses it limited to 36 (0-9+A-Z identifiers) - WRNING web server may not support that many variables
This commit is contained in:
@@ -42,10 +42,10 @@
|
||||
if (loc) d.Sf.action = getURL('/settings/leds');
|
||||
}
|
||||
function bLimits(b,v,p,m,l,o=5,d=2,a=6) {
|
||||
oMaxB = maxB = b; // maxB - max buses (can be changed if using ESP32 parallel I2S)
|
||||
maxD = d; // maxD - max digital channels (can be changed if using ESP32 parallel I2S)
|
||||
maxA = a; // maxA - max analog channels
|
||||
maxV = v; // maxV - min virtual buses
|
||||
oMaxB = maxB = b; // maxB - max buses (can be changed if using ESP32 parallel I2S): 20 - ESP32, 14 - S3/S2, 6 - C3, 4 - 8266
|
||||
maxD = d; // maxD - max digital channels (can be changed if using ESP32 parallel I2S): 17 - ESP32, 12 - S3/S2, 2 - C3, 3 - 8266
|
||||
maxA = a; // maxA - max analog channels: 16 - ESP32, 8 - S3/S2, 6 - C3, 5 - 8266
|
||||
maxV = v; // maxV - min virtual buses: 6 - ESP32/S3, 4 - S2/C3, 3 - ESP8266 (only used to distinguish S2/S3)
|
||||
maxPB = p; // maxPB - max LEDs per bus
|
||||
maxM = m; // maxM - max LED memory
|
||||
maxL = l; // maxL - max LEDs (will serve to determine ESP >1664 == ESP32)
|
||||
@@ -350,6 +350,18 @@
|
||||
else LC.style.color = d.ro_gpio.some((e)=>e==parseInt(LC.value)) ? "orange" : "#fff";
|
||||
}
|
||||
});
|
||||
const S2 = (oMaxB == 14) && (maxV == 4);
|
||||
const S3 = (oMaxB == 14) && (maxV == 6);
|
||||
if (oMaxB == 19 || S2 || S3) { // TODO: crude ESP32 & S2/S3 detection
|
||||
if (maxLC > 300 || dC <= 2) {
|
||||
d.Sf["PR"].checked = false;
|
||||
gId("prl").classList.add("hide");
|
||||
} else
|
||||
gId("prl").classList.remove("hide");
|
||||
// S2 supports mono I2S as well as parallel so we need to take that into account; S3 only supports parallel
|
||||
maxD = (S2 || S3 ? 4 : 8) + (d.Sf["PR"].checked ? 8 : S2); // TODO: use bLimits() : 4/8RMT + (x1/x8 parallel) I2S1
|
||||
maxB = oMaxB - (d.Sf["PR"].checked ? 0 : 7 + S3); // S2 (maxV==4) does support mono I2S
|
||||
}
|
||||
// distribute ABL current if not using PPL
|
||||
enPPL(sDI);
|
||||
|
||||
@@ -409,8 +421,8 @@
|
||||
if (isVir(t)) virtB++;
|
||||
});
|
||||
|
||||
if ((n==1 && i>=maxB+maxV) || (n==-1 && i==0)) return;
|
||||
var s = String.fromCharCode((i<10?48:55)+i);
|
||||
if ((n==1 && i>=36) || (n==-1 && i==0)) return; // used to be i>=maxB+maxV when virtual buses were limited (now :"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||
var s = chrID(i);
|
||||
|
||||
if (n==1) {
|
||||
// npm run build has trouble minimizing spaces inside string
|
||||
@@ -484,7 +496,7 @@ mA/LED: <select name="LAsel${s}" onchange="enLA(this,'${s}');UI();">
|
||||
o[i].querySelector("[name^=LT]").disabled = false;
|
||||
}
|
||||
|
||||
gId("+").style.display = (i<maxB+maxV-1) ? "inline":"none";
|
||||
gId("+").style.display = (i<35) ? "inline":"none"; // was maxB+maxV-1 when virtual buses were limited (now :"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||
gId("-").style.display = (i>0) ? "inline":"none";
|
||||
|
||||
if (!init) {
|
||||
@@ -603,22 +615,32 @@ Swap: <select id="xw${s}" name="XW${s}">
|
||||
|
||||
function receivedText(e) {
|
||||
let lines = e.target.result;
|
||||
var c = JSON.parse(lines);
|
||||
let c = JSON.parse(lines);
|
||||
if (c.hw) {
|
||||
if (c.hw.led) {
|
||||
for (var i=0; i<10; i++) addLEDs(-1);
|
||||
var l = c.hw.led;
|
||||
// remove all existing outputs
|
||||
for (const i=0; i<36; i++) addLEDs(-1); // was i<maxb+maxV when number of virtual buses was limited (now :"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||
let l = c.hw.led;
|
||||
l.ins.forEach((v,i,a)=>{
|
||||
addLEDs(1);
|
||||
for (var j=0; j<v.pin.length; j++) d.getElementsByName(`L${j}${i}`)[0].value = v.pin[j];
|
||||
d.getElementsByName("LT"+i)[0].value = v.type;
|
||||
d.getElementsByName("LS"+i)[0].value = v.start;
|
||||
d.getElementsByName("LC"+i)[0].value = v.len;
|
||||
d.getElementsByName("CO"+i)[0].value = v.order;
|
||||
d.getElementsByName("SL"+i)[0].value = v.skip;
|
||||
d.getElementsByName("LT"+i)[0].value = v.type;
|
||||
d.getElementsByName("LS"+i)[0].value = v.start;
|
||||
d.getElementsByName("LC"+i)[0].value = v.len;
|
||||
d.getElementsByName("CO"+i)[0].value = v.order & 0x0F;
|
||||
d.getElementsByName("SL"+i)[0].value = v.skip;
|
||||
d.getElementsByName("RF"+i)[0].checked = v.ref;
|
||||
d.getElementsByName("CV"+i)[0].checked = v.rev;
|
||||
d.getElementsByName("AW"+i)[0].value = v.rgbwm;
|
||||
d.getElementsByName("WO"+i)[0].value = (v.order>>4) & 0x0F;
|
||||
d.getElementsByName("SP"+i)[0].value = v.freq;
|
||||
d.getElementsByName("LA"+i)[0].value = v.ledma;
|
||||
d.getElementsByName("MA"+i)[0].value = v.maxpwr;
|
||||
});
|
||||
d.getElementsByName("PR")[0].checked = l.prl | 0;
|
||||
d.getElementsByName("LD")[0].checked = l.ld;
|
||||
d.getElementsByName("MA")[0].value = l.maxpwr;
|
||||
d.getElementsByName("ABL")[0].checked = l.maxpwr > 0;
|
||||
}
|
||||
if(c.hw.com) {
|
||||
resetCOM();
|
||||
@@ -626,22 +648,28 @@ Swap: <select id="xw${s}" name="XW${s}">
|
||||
addCOM(e.start, e.len, e.order);
|
||||
});
|
||||
}
|
||||
if (c.hw.btn) {
|
||||
var b = c.hw.btn;
|
||||
let b = c.hw.btn;
|
||||
if (b) {
|
||||
if (Array.isArray(b.ins)) gId("btns").innerHTML = "";
|
||||
b.ins.forEach((v,i,a)=>{
|
||||
addBtn(i,v.pin[0],v.type);
|
||||
});
|
||||
d.getElementsByName("TT")[0].value = b.tt;
|
||||
}
|
||||
if (c.hw.ir) {
|
||||
d.getElementsByName("IR")[0].value = c.hw.ir.pin;
|
||||
d.getElementsByName("IT")[0].value = c.hw.ir.type;
|
||||
let ir = c.hw.ir;
|
||||
if (ir) {
|
||||
d.getElementsByName("IR")[0].value = ir.pin;
|
||||
d.getElementsByName("IT")[0].value = ir.type;
|
||||
}
|
||||
if (c.hw.relay) {
|
||||
d.getElementsByName("RL")[0].value = c.hw.relay.pin;
|
||||
d.getElementsByName("RM")[0].checked = c.hw.relay.rev;
|
||||
d.getElementsByName("RO")[0].checked = c.hw.relay.odrain;
|
||||
let rl = c.hw.relay;
|
||||
if (rl) {
|
||||
d.getElementsByName("RL")[0].value = rl.pin;
|
||||
d.getElementsByName("RM")[0].checked = rl.rev;
|
||||
d.getElementsByName("RO")[0].checked = rl.odrain;
|
||||
}
|
||||
let li = c.light;
|
||||
if (li) {
|
||||
d.getElementsByName("MS")[0].checked = li.aseg;
|
||||
}
|
||||
UI();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user