Skip to content

Commit 9b3e627

Browse files
committed
Auto start field population in bus config
1 parent 71edc3a commit 9b3e627

File tree

6 files changed

+29
-15
lines changed

6 files changed

+29
-15
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
### Development versions after 0.11.1 release
44

5+
#### Build 2103060
6+
7+
- Auto start field population in bus config
8+
59
#### Build 2103050
610

711
- Fixed incorrect over-memory indication in LED settings on ESP32

wled00/const.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
// maximum number of LEDs - more than 1500 LEDs (or 500 DMA "LEDPIN 3" driven ones) will cause a low memory condition on ESP8266
189189
#ifndef MAX_LEDS
190190
#ifdef ESP8266
191-
#define MAX_LEDS 2048
191+
#define MAX_LEDS 8192 //rely on memory limit to limit this to 1600 LEDs
192192
#else
193193
#define MAX_LEDS 8192
194194
#endif
@@ -202,6 +202,10 @@
202202
#endif
203203
#endif
204204

205+
#ifndef MAX_LEDS_PER_BUS
206+
#define MAX_LEDS_PER_BUS 4096
207+
#endif
208+
205209
// string temp buffer (now stored in stack locally)
206210
#define OMAX 2048
207211

wled00/data/settings_leds.htm

Lines changed: 11 additions & 5 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,bquot=0; //maximum bytes for LED allocation: 5kB for 8266, 32kB for 32
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
99
function H()
1010
{
1111
window.open("https://github.com/Aircoookie/WLED/wiki/Settings#led-settings");
@@ -14,8 +14,8 @@
1414
{
1515
window.open("/settings","_self");
1616
}
17-
function bLimits(b,m) {
18-
maxB = b; maxM = m;
17+
function bLimits(b,p,m) {
18+
maxB = b; maxM = m; maxPB = p;
1919
}
2020
function trySubmit() {
2121
var LCs = d.getElementsByTagName("input");
@@ -178,6 +178,12 @@
178178
d.getElementById('psu').innerHTML = s;
179179
d.getElementById('psu2').innerHTML = isWS2815 ? "" : s2;
180180
}
181+
function lastEnd(i) {
182+
if (i<1) return 0;
183+
v = parseInt(d.getElementsByName("LS"+(i-1))[0].value) + parseInt(d.getElementsByName("LC"+(i-1))[0].value);
184+
if (isNaN(v)) return 0;
185+
return v;
186+
}
181187
function addLEDs(n)
182188
{
183189
if (n>1) {maxB=n; d.getElementById("+").style.display="inline"; return;}
@@ -222,9 +228,9 @@
222228
<span id="p3d${i}"></span><input type="number" name="L3${i}" min="0" max="40" style="width:35px"/>
223229
<span id="p4d${i}"></span><input type="number" name="L4${i}" min="0" max="40" style="width:35px"/>
224230
<br>
225-
<span id="psd${i}">Start:</span> <input type="number" name="LS${i}" min="0" max="8191" value="0" required />&nbsp;
231+
<span id="psd${i}">Start:</span> <input type="number" name="LS${i}" min="0" max="8191" value="${lastEnd(i)}" required />&nbsp;
226232
<div id="dig${i}" style="display:inline">
227-
Count: <input type="number" name="LC${i}" min="0" max="2048" value="1" required oninput="UI()" /><br>
233+
Count: <input type="number" name="LC${i}" min="0" max="${maxPB}" value="1" required oninput="UI()" /><br>
228234
Reverse: <input type="checkbox" name="CV${i}"></div><br>
229235
</div>`;
230236
f.insertAdjacentHTML("beforeend", cn);

wled00/html_settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Do not enable if WiFi is working correctly, increases power consumption.</i><div
7272
// Autogenerated from wled00/data/settings_leds.htm, do not edit!!
7373
const char PAGE_settings_leds[] PROGMEM = R"=====(<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta
7474
name="viewport" content="width=500"><title>LED Settings</title><script>
75-
var d=document,laprev=55,maxB=1,maxM=5e3,bquot=0;function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#led-settings")}function B(){window.open("/settings","_self")}function bLimits(e,n){maxB=e,maxM=n}function trySubmit(){var e=d.getElementsByTagName("input");for(i=0;i<e.length;i++){var n=e[i].name.substring(0,2);if(("L0"==n||"L1"==n||"RL"==n||"BT"==n||"IR"==n||"AX"==n)&&""!=e[i].value&&"-1"!=e[i].value){if(e[i].value>5&&e[i].value<12)return alert("Sorry, pins 6-11 can not be used."),void e[i].focus();if(d.um_p&&d.um_p.some(n=>n==parseInt(e[i].value,10)))return alert("Usermod pin conflict!"),void e[i].focus();for(j=i+1;j<e.length;j++){var t=e[j].name.substring(0,2);if(("L0"==t||"L1"==t||"RL"==t||"BT"==t||"IR"==t||"AX"==t)&&""!=e[j].value&&e[i].value==e[j].value)return alert("Pin conflict!"),void e[i].focus()}}}if(bquot>100){var a="Too many LEDs for me to handle!";return maxM<1e4&&(a+=" Consider using an ESP32."),void alert(a)}d.Sf.reportValidity()&&d.Sf.submit()}function S(){GetV(),setABL()}function enABL(){var e=d.getElementById("able").checked;d.Sf.LA.value=e?laprev:0,d.getElementById("abl").style.display=e?"inline":"none",d.getElementById("psu2").style.display=e?"inline":"none",d.Sf.LA.value>0&&setABL()}function enLA(){var e=d.Sf.LAsel.value;d.Sf.LA.value=e,d.getElementById("LAdis").style.display=50==e?"inline":"none",UI()}function setABL(){switch(d.getElementById("able").checked=!0,d.Sf.LAsel.value=50,parseInt(d.Sf.LA.value)){case 0:d.getElementById("able").checked=!1,enABL();break;case 30:d.Sf.LAsel.value=30;break;case 35:d.Sf.LAsel.value=35;break;case 55:d.Sf.LAsel.value=55;break;case 255:d.Sf.LAsel.value=255;break;default:d.getElementById("LAdis").style.display="inline"}d.getElementById("m1").innerHTML=maxM,UI()}function getMem(e,n,t){return e<32?maxM<1e4&&3==t?e>29?20*n:15*n:maxM>=1e4?e>29?8*n:6*n:e>29?4*n:3*n:e>31&&e<48?5:44==e||45==e?4*n:3*n}function UI(){var e=!1,t=0;d.getElementById("ampwarning").style.display=d.Sf.MA.value>7200?"inline":"none",255==d.Sf.LA.value?laprev=12:d.Sf.LA.value>0&&(laprev=d.Sf.LA.value);var i=d.getElementsByTagName("select");for(u=0;u<i.length;u++)if("LT"==i[u].name.substring(0,2)){n=i[u].name.substring(2);var a=i[u].value;d.getElementById("p0d"+n).innerHTML=a>49?"Data pin:":a>41?"Pins:":"Pin:",d.getElementById("p1d"+n).innerHTML=a>49?"Clk:":"";var l=d.getElementsByName("L1"+n)[0];for(t+=getMem(a,d.getElementsByName("LC"+n)[0].value,d.getElementsByName("L0"+n)[0].value),p=1;p<5;p++){(l=d.getElementsByName("L"+p+n)[0])&&(a>49&&1==p||a>41&&a<50&&p+40<a?(l.style.display="inline",l.required=!0):(l.style.display="none",l.required=!1,l.value=""))}(30==a||31==a||a>40&&a<46&&43!=a)&&(e=!0),d.getElementById("dig"+n).style.display=a>31&&a<48?"none":"inline",d.getElementById("psd"+n).innerHTML=a>31&&a<48?"Index:":"Start:"}var o=d.querySelectorAll(".wc"),s=o.length;for(u=0;u<s;u++)o[u].style.display=e?"inline":"none";if(d.activeElement==d.getElementsByName("LC")[0]){var u=d.getElementsByClassName("iST").length;1==u&&(d.getElementsByName("LC0")[0].value=d.getElementsByName("LC")[0].value)}var r=d.getElementsByTagName("input"),m=0,v=0;for(u=0;u<r.length;u++){if("LC"!=r[u].name.substring(0,2)||"LC"==r[u].name);else{var y=parseInt(r[u].value,10);y&&(m+=y,y>v&&(v=y))}}d.getElementById("m0").innerHTML=t,bquot=t/maxM*100,d.getElementById("dbar").style.background=`linear-gradient(90deg, ${bquot>60?bquot>90?"red":"orange":"#ccc"} 0 ${bquot}%%, #444 ${bquot}%% 100%%)`,d.getElementById("ledwarning").style.display=v>800||bquot>80?"inline":"none",d.getElementById("wreason").innerHTML=bquot>80?"than 60%% of max. LED memory":"800 LEDs per pin";var g=Math.ceil((100+m*laprev)/500)/2;g=g>5?Math.ceil(g):g;i="";var L=30==d.Sf.LAsel.value,c=255==d.Sf.LAsel.value;g<1.02&&!L&&!c?i="ESP 5V pin with 1A USB supply":(i+=L?"12V ":c?"WS2815 12V ":"5V ",i+=g,i+="A supply connected to LEDs");var f=Math.ceil((100+m*laprev)/1500)/2,B="(for most effects, ~";B+=f=f>5?Math.ceil(f):f,B+="A is enough)<br>",d.getElementById("psu").innerHTML=i,d.getElementById("psu2").innerHTML=c?"":B}function addLEDs(e){if(e>1)return maxB=e,void(d.getElementById("+").style.display="inline");var n=d.getElementsByClassName("iST"),t=n.length;if(!(1==e&&t>=maxB||-1==e&&0==t)){var i=d.getElementById("mLC");if(1==e){var a=`<div class="iST">\n ${t>0?'<hr style="width:260px">':""}\n ${t+1}:\n <select name="LT${t}" onchange="UI()">\n <option value="22">WS281x</option>\n <option value="30">SK6812 RGBW</option>\n <option value="31">TM1814</option>\n <option value="24">400kHz</option>\n <option value="50">WS2801</option>\n <option value="51">APA102</option>\n <option value="52">LPD8806</option>\n <option value="53">P9813</option>\n <option value="41">PWM White</option>\n <option value="42">PWM WWCW</option>\n <option value="43">PWM RGB</option>\n <option value="44">PWM RGBW</option>\n <option value="45">PWM RGBWC</option>\n </select>&nbsp;\n Color Order:\n <select name="CO${t}">\n <option value="0">GRB</option>\n <option value="1">RGB</option>\n <option value="2">BRG</option>\n <option value="3">RBG</option>\n <option value="4">BGR</option>\n <option value="5">GBR</option>\n </select><br>\n <span id="p0d${t}">Pin:</span> <input type="number" name="L0${t}" min="0" max="40" required style="width:35px" oninput="UI()"/>\n <span id="p1d${t}">Clock:</span> <input type="number" name="L1${t}" min="0" max="40" style="width:35px"/>\n <span id="p2d${t}"></span><input type="number" name="L2${t}" min="0" max="40" style="width:35px"/>\n <span id="p3d${t}"></span><input type="number" name="L3${t}" min="0" max="40" style="width:35px"/>\n <span id="p4d${t}"></span><input type="number" name="L4${t}" min="0" max="40" style="width:35px"/>\n <br>\n <span id="psd${t}">Start:</span> <input type="number" name="LS${t}" min="0" max="8191" value="0" required />&nbsp;\n <div id="dig${t}" style="display:inline">\n Count: <input type="number" name="LC${t}" min="0" max="2048" value="1" required oninput="UI()" /><br>\n Reverse: <input type="checkbox" name="CV${t}"></div><br>\n </div>`;i.insertAdjacentHTML("beforeend",a)}-1==e&&(n[--t].remove(),--t),d.getElementById("+").style.display=t<maxB-1?"inline":"none",d.getElementById("-").style.display=t>0?"inline":"none",UI()}}function GetV() {var d=document;
75+
var d=document,laprev=55,maxB=1,maxM=5e3,maxPB=4096,bquot=0;function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#led-settings")}function B(){window.open("/settings","_self")}function bLimits(e,n,t){maxB=e,maxM=t,maxPB=n}function trySubmit(){var e=d.getElementsByTagName("input");for(i=0;i<e.length;i++){var n=e[i].name.substring(0,2);if(("L0"==n||"L1"==n||"RL"==n||"BT"==n||"IR"==n||"AX"==n)&&""!=e[i].value&&"-1"!=e[i].value){if(e[i].value>5&&e[i].value<12)return alert("Sorry, pins 6-11 can not be used."),void e[i].focus();if(d.um_p&&d.um_p.some(n=>n==parseInt(e[i].value,10)))return alert("Usermod pin conflict!"),void e[i].focus();for(j=i+1;j<e.length;j++){var t=e[j].name.substring(0,2);if(("L0"==t||"L1"==t||"RL"==t||"BT"==t||"IR"==t||"AX"==t)&&""!=e[j].value&&e[i].value==e[j].value)return alert("Pin conflict!"),void e[i].focus()}}}if(bquot>100){var a="Too many LEDs for me to handle!";return maxM<1e4&&(a+=" Consider using an ESP32."),void alert(a)}d.Sf.reportValidity()&&d.Sf.submit()}function S(){GetV(),setABL()}function enABL(){var e=d.getElementById("able").checked;d.Sf.LA.value=e?laprev:0,d.getElementById("abl").style.display=e?"inline":"none",d.getElementById("psu2").style.display=e?"inline":"none",d.Sf.LA.value>0&&setABL()}function enLA(){var e=d.Sf.LAsel.value;d.Sf.LA.value=e,d.getElementById("LAdis").style.display=50==e?"inline":"none",UI()}function setABL(){switch(d.getElementById("able").checked=!0,d.Sf.LAsel.value=50,parseInt(d.Sf.LA.value)){case 0:d.getElementById("able").checked=!1,enABL();break;case 30:d.Sf.LAsel.value=30;break;case 35:d.Sf.LAsel.value=35;break;case 55:d.Sf.LAsel.value=55;break;case 255:d.Sf.LAsel.value=255;break;default:d.getElementById("LAdis").style.display="inline"}d.getElementById("m1").innerHTML=maxM,UI()}function getMem(e,n,t){return e<32?maxM<1e4&&3==t?e>29?20*n:15*n:maxM>=1e4?e>29?8*n:6*n:e>29?4*n:3*n:e>31&&e<48?5:44==e||45==e?4*n:3*n}function UI(){var e=!1,t=0;d.getElementById("ampwarning").style.display=d.Sf.MA.value>7200?"inline":"none",255==d.Sf.LA.value?laprev=12:d.Sf.LA.value>0&&(laprev=d.Sf.LA.value);var i=d.getElementsByTagName("select");for(u=0;u<i.length;u++)if("LT"==i[u].name.substring(0,2)){n=i[u].name.substring(2);var a=i[u].value;d.getElementById("p0d"+n).innerHTML=a>49?"Data pin:":a>41?"Pins:":"Pin:",d.getElementById("p1d"+n).innerHTML=a>49?"Clk:":"";var l=d.getElementsByName("L1"+n)[0];for(t+=getMem(a,d.getElementsByName("LC"+n)[0].value,d.getElementsByName("L0"+n)[0].value),p=1;p<5;p++){(l=d.getElementsByName("L"+p+n)[0])&&(a>49&&1==p||a>41&&a<50&&p+40<a?(l.style.display="inline",l.required=!0):(l.style.display="none",l.required=!1,l.value=""))}(30==a||31==a||a>40&&a<46&&43!=a)&&(e=!0),d.getElementById("dig"+n).style.display=a>31&&a<48?"none":"inline",d.getElementById("psd"+n).innerHTML=a>31&&a<48?"Index:":"Start:"}var o=d.querySelectorAll(".wc"),s=o.length;for(u=0;u<s;u++)o[u].style.display=e?"inline":"none";if(d.activeElement==d.getElementsByName("LC")[0]){var u=d.getElementsByClassName("iST").length;1==u&&(d.getElementsByName("LC0")[0].value=d.getElementsByName("LC")[0].value)}var r=d.getElementsByTagName("input"),m=0,v=0;for(u=0;u<r.length;u++){if("LC"!=r[u].name.substring(0,2)||"LC"==r[u].name);else{var y=parseInt(r[u].value,10);y&&(m+=y,y>v&&(v=y))}}d.getElementById("m0").innerHTML=t,bquot=t/maxM*100,d.getElementById("dbar").style.background=`linear-gradient(90deg, ${bquot>60?bquot>90?"red":"orange":"#ccc"} 0 ${bquot}%%, #444 ${bquot}%% 100%%)`,d.getElementById("ledwarning").style.display=v>800||bquot>80?"inline":"none",d.getElementById("wreason").innerHTML=bquot>80?"than 60%% of max. LED memory":"800 LEDs per pin";var g=Math.ceil((100+m*laprev)/500)/2;g=g>5?Math.ceil(g):g;i="";var L=30==d.Sf.LAsel.value,B=255==d.Sf.LAsel.value;g<1.02&&!L&&!B?i="ESP 5V pin with 1A USB supply":(i+=L?"12V ":B?"WS2815 12V ":"5V ",i+=g,i+="A supply connected to LEDs");var c=Math.ceil((100+m*laprev)/1500)/2,f="(for most effects, ~";f+=c=c>5?Math.ceil(c):c,f+="A is enough)<br>",d.getElementById("psu").innerHTML=i,d.getElementById("psu2").innerHTML=B?"":f}function lastEnd(e){return e<1?0:(v=parseInt(d.getElementsByName("LS"+(e-1))[0].value)+parseInt(d.getElementsByName("LC"+(e-1))[0].value),isNaN(v)?0:v)}function addLEDs(e){if(e>1)return maxB=e,void(d.getElementById("+").style.display="inline");var n=d.getElementsByClassName("iST"),t=n.length;if(!(1==e&&t>=maxB||-1==e&&0==t)){var i=d.getElementById("mLC");if(1==e){var a=`<div class="iST">\n ${t>0?'<hr style="width:260px">':""}\n ${t+1}:\n <select name="LT${t}" onchange="UI()">\n <option value="22">WS281x</option>\n <option value="30">SK6812 RGBW</option>\n <option value="31">TM1814</option>\n <option value="24">400kHz</option>\n <option value="50">WS2801</option>\n <option value="51">APA102</option>\n <option value="52">LPD8806</option>\n <option value="53">P9813</option>\n <option value="41">PWM White</option>\n <option value="42">PWM WWCW</option>\n <option value="43">PWM RGB</option>\n <option value="44">PWM RGBW</option>\n <option value="45">PWM RGBWC</option>\n </select>&nbsp;\n Color Order:\n <select name="CO${t}">\n <option value="0">GRB</option>\n <option value="1">RGB</option>\n <option value="2">BRG</option>\n <option value="3">RBG</option>\n <option value="4">BGR</option>\n <option value="5">GBR</option>\n </select><br>\n <span id="p0d${t}">Pin:</span> <input type="number" name="L0${t}" min="0" max="40" required style="width:35px" oninput="UI()"/>\n <span id="p1d${t}">Clock:</span> <input type="number" name="L1${t}" min="0" max="40" style="width:35px"/>\n <span id="p2d${t}"></span><input type="number" name="L2${t}" min="0" max="40" style="width:35px"/>\n <span id="p3d${t}"></span><input type="number" name="L3${t}" min="0" max="40" style="width:35px"/>\n <span id="p4d${t}"></span><input type="number" name="L4${t}" min="0" max="40" style="width:35px"/>\n <br>\n <span id="psd${t}">Start:</span> <input type="number" name="LS${t}" min="0" max="8191" value="${lastEnd(t)}" required />&nbsp;\n <div id="dig${t}" style="display:inline">\n Count: <input type="number" name="LC${t}" min="0" max="${maxPB}" value="1" required oninput="UI()" /><br>\n Reverse: <input type="checkbox" name="CV${t}"></div><br>\n </div>`;i.insertAdjacentHTML("beforeend",a)}-1==e&&(n[--t].remove(),--t),d.getElementById("+").style.display=t<maxB-1?"inline":"none",d.getElementById("-").style.display=t>0?"inline":"none",UI()}}function GetV() {var d=document;
7676
%CSS%%SCSS%</head><body onload="S()"><form
7777
id="form_s" name="Sf" method="post"><div class="helpB"><button type="button"
7878
onclick="H()">?</button></div><button type="button" onclick="B()">Back</button>

wled00/wled.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
// version code in format yymmddb (b = daily build)
11-
#define VERSION 2103050
11+
#define VERSION 2103060
1212

1313
//uncomment this if you have a "my_config.h" file you'd like to use
1414
//#define WLED_USE_MY_CONFIG

wled00/xml.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ void getSettingsJS(byte subPage, char* dest)
272272
oappend(SET_F("];"));
273273
}*/
274274

275-
#if defined(WLED_MAX_BUSSES) && WLED_MAX_BUSSES>1
276-
oappend(SET_F("bLimits("));
277-
oappend(itoa(WLED_MAX_BUSSES,nS,10));
278-
oappend(",");
279-
oappend(itoa(MAX_LED_MEMORY,nS,10));
280-
oappend(SET_F(");"));
281-
#endif
275+
oappend(SET_F("bLimits("));
276+
oappend(itoa(WLED_MAX_BUSSES,nS,10));
277+
oappend(",");
278+
oappend(itoa(MAX_LEDS_PER_BUS,nS,10));
279+
oappend(",");
280+
oappend(itoa(MAX_LED_MEMORY,nS,10));
281+
oappend(SET_F(");"));
282282

283283
oappend(SET_F("d.Sf.LC.max=")); //TODO Formula for max LEDs on ESP8266 depending on types. 500 DMA or 1500 UART (about 4kB mem usage)
284284
oappendi(MAX_LEDS);

0 commit comments

Comments
 (0)