Skip to content

Commit 91598cb

Browse files
committed
Remove Total LEDs field
1 parent 0b0d18f commit 91598cb

File tree

5 files changed

+53
-57
lines changed

5 files changed

+53
-57
lines changed

wled00/bus_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct BusConfig {
3737
type = busType; count = len; start = pstart;
3838
colorOrder = pcolorOrder; reversed = rev; skipAmount = skip;
3939
uint8_t nPins = 1;
40-
if (type >= 10 && type <= 15) nPins = 4;
40+
if (type >= 10 && type <= 15) nPins = 4; //virtual network bus. 4 "pins" store IP address
4141
else if (type > 47) nPins = 2;
4242
else if (type > 40 && type < 46) nPins = NUM_PWM_PINS(type);
4343
for (uint8_t i = 0; i < nPins; i++) pins[i] = ppins[i];

wled00/data/settings_leds.htm

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="viewport" content="width=500">
66
<title>LED Settings</title>
77
<script>
8-
var d=document,laprev=55,maxB=1,maxM=5000,maxPB=4096,bquot=0; //maximum bytes for LED allocation: 5kB for 8266, 32kB for 32
8+
var d=document,laprev=55,maxB=1,maxM=4000,maxPB=4096,maxL=1333,maxLbquot=0; //maximum bytes for LED allocation: 4kB for 8266, 32kB for 32
99
function H()
1010
{
1111
window.open("https://github.com/Aircoookie/WLED/wiki/Settings#led-settings");
@@ -28,8 +28,8 @@
2828
x.style.animation = 'none';
2929
timeout = setTimeout(function(){ x.className = x.className.replace("show", ""); }, 2900);
3030
}
31-
function bLimits(b,p,m) {
32-
maxB = b; maxM = m; maxPB = p;
31+
function bLimits(b,p,m,l) {
32+
maxB = b; maxM = m; maxPB = p; maxL = l;
3333
}
3434
function pinsOK() {
3535
var LCs = d.getElementsByTagName("input");
@@ -160,7 +160,6 @@
160160
}
161161
}
162162
if (change) {
163-
gId("ls"+n).value = n+1; // set LED start
164163
if (t > 31 && t < 48) d.getElementsByName("LC"+n)[0].value = 1; // for sanity change analog count just to 1 LED
165164
}
166165
isRGBW |= (t == 30 || t == 31 || (t > 40 && t < 46 && t != 43)); // RGBW checkbox, TYPE_xxxx values from const.h
@@ -180,23 +179,29 @@
180179
}
181180
// check for pin conflicts
182181
var LCs = d.getElementsByTagName("input");
183-
var sLC = 0, maxLC = 0;
182+
var sLC = 0, sPC = 0, maxLC = 0;
184183
for (i=0; i<LCs.length; i++) {
185184
var nm = LCs[i].name.substring(0,2); // field name
186185
var n = LCs[i].name.substring(2); // bus number
187-
// do we have a led count field but not total led count
188-
if (nm=="LC" && LCs[i].name !== "LC") {
186+
// do we have a led count field
187+
if (nm=="LC") {
189188
var c=parseInt(LCs[i].value,10);
190-
gId("ls"+n).value=sLC; // update led start field
191-
if(c){sLC+=c;if(c>maxLC)maxLC=c;} // increase led count
189+
//gId("ls"+n).value=sLC; // update led start field (TODO except if it has been manually changed)
190+
if(c){
191+
var s = parseInt(gId("ls"+n).value);
192+
if (s+c > sLC) sLC = s+c;
193+
if(c>maxLC)maxLC=c;
194+
var t = parseInt(d.getElementsByName("LT"+n)[0].value, 10); // LED type SELECT
195+
if (t>16) sPC+=c; //virtual out busses do not count towards physical LEDs
196+
} // increase led count
192197
continue;
193198
}
194199
// do we have led pins for digital leds
195200
if (nm=="L0" || nm=="L1") {
196201
var lc=d.getElementsByName("LC"+n)[0];
197202
lc.max=maxPB; // update max led count value
198203
}
199-
// ignore IP address
204+
// ignore IP address (stored in pins for virtual busses)
200205
if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3") {
201206
var t = parseInt(d.getElementsByName("LT"+n)[0].value, 10); // LED type SELECT
202207
if (t<16) {
@@ -230,22 +235,18 @@
230235
}
231236
}
232237
// update total led count
233-
if (gId("LC").readOnly) d.getElementsByName("LC")[0].value = sLC;
234-
// if we are changing total led count update led count for 1st strip
235-
if (d.activeElement == d.getElementsByName("LC")[0]) {
236-
var o = d.getElementsByClassName("iST");
237-
var i = o.length;
238-
if (i == 1) d.getElementsByName("LC0")[0].value = d.getElementsByName("LC")[0].value;
239-
}
238+
gId("lc").textContent = sLC;
239+
gId("pc").textContent = (sLC == sPC) ? "":"(" + sPC + " physical)";
240+
240241
// memory usage and warnings
241242
gId('m0').innerHTML = memu;
242243
bquot = memu / maxM * 100;
243244
gId('dbar').style.background = `linear-gradient(90deg, ${bquot > 60 ? (bquot > 90 ? "red":"orange"):"#ccc"} 0 ${bquot}%%, #444 ${bquot}%% 100%%)`;
244245
gId('ledwarning').style.display = (sLC > maxPB || maxLC > 800 || bquot > 80) ? 'inline':'none';
245246
gId('ledwarning').style.color = (sLC > maxPB || maxLC > maxPB || bquot > 100) ? 'red':'orange';
246-
gId('wreason').innerHTML = (bquot > 80) ? "80% of max. LED memory" +(bquot>100 ? ` (<b>WARNING: Using over ${maxM}B!</b>)` : "") : "800 LEDs per GPIO";
247+
gId('wreason').innerHTML = (bquot > 80) ? "80% of max. LED memory" +(bquot>100 ? ` (<b>ERROR: Using over ${maxM}B!</b>)` : "") : "800 LEDs per output";
247248
// calculate power
248-
var val = Math.ceil((100 + sLC * laprev)/500)/2;
249+
var val = Math.ceil((100 + sPC * laprev)/500)/2;
249250
val = (val > 5) ? Math.ceil(val) : val;
250251
var s = "";
251252
var is12V = (d.Sf.LAsel.value == 30);
@@ -259,7 +260,7 @@
259260
s += val;
260261
s += "A supply connected to LEDs";
261262
}
262-
var val2 = Math.ceil((100 + sLC * laprev)/1500)/2;
263+
var val2 = Math.ceil((100 + sPC * laprev)/1500)/2;
263264
val2 = (val2 > 5) ? Math.ceil(val2) : val2;
264265
var s2 = "(for most effects, ~";
265266
s2 += val2;
@@ -319,15 +320,15 @@
319320
<option value="5">GBR</option>
320321
</select></div>
321322
<br>
322-
<span id="p0d${i}">GPIO:</span><input type="number" name="L0${i}" min="0" max="33" required class="xs" onchange="UI()"/>
323+
<span id="psd${i}">Start:</span> <input type="number" name="LS${i}" id="ls${i}" class="l" min="0" max="8191" value="${lastEnd(i)}" onchange="UI()" required />&nbsp;
324+
<div id="dig${i}c" style="display:inline">Length: <input type="number" name="LC${i}" class="l" min="1" max="${maxPB}" value="1" required oninput="UI()" /></div>
325+
<br>
326+
<span id="p0d${i}">GPIO:</span> <input type="number" name="L0${i}" min="0" max="33" required class="xs" onchange="UI()"/>
323327
<span id="p1d${i}"></span><input type="number" name="L1${i}" min="0" max="33" class="xs" onchange="UI()"/>
324328
<span id="p2d${i}"></span><input type="number" name="L2${i}" min="0" max="33" class="xs" onchange="UI()"/>
325329
<span id="p3d${i}"></span><input type="number" name="L3${i}" min="0" max="33" class="xs" onchange="UI()"/>
326330
<span id="p4d${i}"></span><input type="number" name="L4${i}" min="0" max="33" class="xs" onchange="UI()"/>
327331
<br>
328-
<span id="psd${i}">Start:</span> <input type="number" name="LS${i}" id="ls${i}" class="l" min="0" max="8191" value="${lastEnd(i)}" disabled readonly required />&nbsp;
329-
<div id="dig${i}c" style="display:inline">Count: <input type="number" name="LC${i}" class="l" min="0" max="${maxPB}" value="1" required oninput="UI()" /></div>
330-
<br>
331332
<div id="dig${i}r" style="display:inline"><span id="rev${i}">Reversed</span>: <input type="checkbox" name="CV${i}"></div>&nbsp;
332333
<div id="dig${i}s" style="display:inline">Skip 1<sup>st</sup> LED: <input id="sl${i}" type="checkbox" name="SL${i}"></div>
333334
<br>
@@ -348,7 +349,7 @@
348349
var bt = "BT" + i;
349350
var be = "BE" + i;
350351
c += `Button ${i} GPIO: <input type="number" min="-1" max="40" name="${bt}" onchange="UI()" class="xs" value="${p}">`;
351-
c += `<select name="${be}">`
352+
c += `&nbsp;<select name="${be}">`
352353
c += `<option value="0" ${t==0?"selected":""}>Disabled</option>`;
353354
c += `<option value="2" ${t==2?"selected":""}>Pushbutton</option>`;
354355
c += `<option value="3" ${t==3?"selected":""}>Push inverted</option>`;
@@ -375,7 +376,7 @@
375376
function GetV()
376377
{
377378
//values injected by server while sending HTML
378-
//maxM=5000;maxPB=1536;d.um_p=[1,6,7,8,9,10,11];addLEDs(3);d.Sf.LC.value=250;addLEDs(1);d.Sf.L00.value=2;d.Sf.L10.value=0;d.Sf.LC0.value=250;d.Sf.LT0.value=22;d.Sf.CO0.value=0;d.Sf.LS0.value=0;d.Sf.LS0.checked=0;d.Sf.MA.value=5400;d.Sf.LA.value=55;d.getElementsByClassName("pow")[0].innerHTML="350mA";d.Sf.CA.value=40;d.Sf.AW.value=3;d.Sf.BO.checked=0;d.Sf.BP.value=3;d.Sf.GB.checked=0;d.Sf.GC.checked=1;d.Sf.TF.checked=1;d.Sf.TD.value=700;d.Sf.PF.checked=0;d.Sf.BF.value=64;d.Sf.TB.value=0;d.Sf.TL.value=60;d.Sf.TW.value=1;d.Sf.PB.selectedIndex=0;d.Sf.RL.value=12;d.Sf.RM.checked=0;addBtn(0,0,2);addBtn(1,3,4);addBtn(2,-1,0);d.Sf.IR.value=-1;
379+
//d.um_p=[6,7,8,9,10,11];bLimits(3,4096,4000,1664);d.Sf.MS.checked=0;addLEDs(1);d.Sf.L00.value=2;d.Sf.LC0.value=29;d.Sf.LT0.value=22;d.Sf.CO0.value=0;d.Sf.LS0.value=12;d.Sf.CV0.checked=0;d.Sf.SL0.checked=0;d.Sf.MA.value=850;d.Sf.LA.value=0;d.Sf.CA.value=56;d.Sf.AW.value=3;d.Sf.BO.checked=1;d.Sf.BP.value=80;d.Sf.GB.checked=0;d.Sf.GC.checked=1;d.Sf.TF.checked=1;d.Sf.TD.value=700;d.Sf.PF.checked=0;d.Sf.BF.value=100;d.Sf.TB.value=0;d.Sf.TL.value=60;d.Sf.TW.value=0;d.Sf.PB.selectedIndex=0;d.Sf.RL.value=12;d.Sf.RM.checked=1;addBtn(0,0,0);addBtn(1,-1,0);d.Sf.TT.value=32;d.Sf.IR.value=-1;d.Sf.IT.value=0;
379380
}
380381
</script>
381382
<style>
@@ -387,7 +388,7 @@
387388
<div class="helpB"><button type="button" onclick="H()">?</button></div>
388389
<button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
389390
<h2>LED &amp; Hardware setup</h2>
390-
Total LED count: <input name="LC" id="LC" type="number" min="1" max="8192" oninput="UI()" disabled required readonly><br>
391+
Total LEDs: <span id="lc">?</span> <span id="pc"></span><br>
391392
<i>Recommended power supply for brightest white:</i><br>
392393
<b><span id="psu">?</span></b><br>
393394
<span id="psu2"><br></span>
@@ -425,10 +426,10 @@ <h3>Hardware setup</h3>
425426
<div id="dbar" style="display:inline-block; width: 100px; height: 10px; border-radius: 20px;"></div><br>
426427
<div id="ledwarning" style="color: orange; display: none;">
427428
&#9888; You might run into stability or lag issues.<br>
428-
Use less than <span id="wreason">800 LEDs per pin</span> for the best experience!<br>
429+
Use less than <span id="wreason">800 LEDs per output</span> for the best experience!<br>
429430
</div>
430-
<hr style="width:260px">
431431
Make a segment for each output: <input type="checkbox" name="MS"> <br>
432+
<!--Custom bus start indices: <input type="checkbox" id="cs"> <br>-->
432433
<hr style="width:260px">
433434
<div id="btns"></div>
434435
Touch threshold: <input type="number" class="s" min="0" max="100" name="TT" required><br>
@@ -446,7 +447,7 @@ <h3>Hardware setup</h3>
446447
<div id="json" style="display:none;">JSON file: <input type="file" name="data" accept=".json"> <input type="button" value="Upload" onclick="uploadFile('/ir.json');"><br></div>
447448
<div id="toast"></div>
448449
<a href="https://github.com/Aircoookie/WLED/wiki/Infrared-Control" target="_blank">IR info</a><br>
449-
Relay GPIO: <input type="number" min="-1" max="33" name="RL" onchange="UI()" class="xs"> invert <input type="checkbox" name="RM"><span style="cursor: pointer;" onclick="off('RL')">&nbsp;&#215;</span><br>
450+
Relay GPIO: <input type="number" min="-1" max="33" name="RL" onchange="UI()" class="xs"> Invert <input type="checkbox" name="RM"><span style="cursor: pointer;" onclick="off('RL')">&nbsp;&#215;</span><br>
450451
<hr style="width:260px">
451452
<h3>Defaults</h3>
452453
Turn LEDs on after power up/reset: <input type="checkbox" name="BO"><br>

0 commit comments

Comments
 (0)