PR Feedback
- Limit max number of color order overrides to 5 on ESP8266 - Only append color overrides if they were provided in the POST of LED settings.
This commit is contained in:
parent
b8e23b2d7e
commit
5c39d8d12e
@ -39,7 +39,11 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ESP8266
|
||||||
|
#define WLED_MAX_COLOR_ORDER_MAPPINGS 5
|
||||||
|
#else
|
||||||
#define WLED_MAX_COLOR_ORDER_MAPPINGS 10
|
#define WLED_MAX_COLOR_ORDER_MAPPINGS 10
|
||||||
|
#endif
|
||||||
|
|
||||||
//Usermod IDs
|
//Usermod IDs
|
||||||
#define USERMOD_ID_RESERVED 0 //Unused. Might indicate no usermod present
|
#define USERMOD_ID_RESERVED 0 //Unused. Might indicate no usermod present
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<title>LED Settings</title>
|
<title>LED Settings</title>
|
||||||
<script>
|
<script>
|
||||||
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
|
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
|
||||||
var customStarts=false,startsDirty=[];
|
var customStarts=false,startsDirty=[],maxCOOverrides=5;
|
||||||
function H()
|
function H()
|
||||||
{
|
{
|
||||||
window.open("https://kno.wled.ge/features/settings/#led-settings");
|
window.open("https://kno.wled.ge/features/settings/#led-settings");
|
||||||
@ -379,7 +379,10 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
|||||||
btnCOM(i-1);
|
btnCOM(i-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetCOM() {
|
function resetCOM(_newMaxCOOverrides=undefined) {
|
||||||
|
if (_newMaxCOOverrides) {
|
||||||
|
maxCOOverrides = _newMaxCOOverrides;
|
||||||
|
}
|
||||||
for (let e of d.getElementsByClassName("com_entry")) {
|
for (let e of d.getElementsByClassName("com_entry")) {
|
||||||
e.remove();
|
e.remove();
|
||||||
}
|
}
|
||||||
@ -387,7 +390,7 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
|||||||
}
|
}
|
||||||
|
|
||||||
function btnCOM(i) {
|
function btnCOM(i) {
|
||||||
gId("com_add").style.display = (i<10) ? "inline":"none";
|
gId("com_add").style.display = (i<maxCOOverrides) ? "inline":"none";
|
||||||
gId("com_rem").style.display = (i>0) ? "inline":"none";
|
gId("com_rem").style.display = (i>0) ? "inline":"none";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -141,10 +141,12 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
char xs[4] = "XS"; xs[2] = 48+s; xs[3] = 0; //start LED
|
char xs[4] = "XS"; xs[2] = 48+s; xs[3] = 0; //start LED
|
||||||
char xc[4] = "XC"; xc[2] = 48+s; xc[3] = 0; //strip length
|
char xc[4] = "XC"; xc[2] = 48+s; xc[3] = 0; //strip length
|
||||||
char xo[4] = "XO"; xo[2] = 48+s; xo[3] = 0; //color order
|
char xo[4] = "XO"; xo[2] = 48+s; xo[3] = 0; //color order
|
||||||
start = request->arg(xs).toInt();
|
if (request->hasArg(xs)) {
|
||||||
length = request->arg(xc).toInt();
|
start = request->arg(xs).toInt();
|
||||||
colorOrder = request->arg(xo).toInt();
|
length = request->arg(xc).toInt();
|
||||||
com.add(start, length, colorOrder);
|
colorOrder = request->arg(xo).toInt();
|
||||||
|
com.add(start, length, colorOrder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
busses.updateColorOrderMap(com);
|
busses.updateColorOrderMap(com);
|
||||||
|
|
||||||
|
@ -421,7 +421,9 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
oappend(SET_F("mA\";"));
|
oappend(SET_F("mA\";"));
|
||||||
}
|
}
|
||||||
|
|
||||||
oappend(SET_F("resetCOM();"));
|
oappend(SET_F("resetCOM("));
|
||||||
|
oappend(itoa(WLED_MAX_COLOR_ORDER_MAPPINGS,nS,10));
|
||||||
|
oappend(SET_F(");"));
|
||||||
const ColorOrderMap& com = busses.getColorOrderMap();
|
const ColorOrderMap& com = busses.getColorOrderMap();
|
||||||
for (uint8_t s=0; s < com.count(); s++) {
|
for (uint8_t s=0; s < com.count(); s++) {
|
||||||
const ColorOrderMapEntry* entry = com.get(s);
|
const ColorOrderMapEntry* entry = com.get(s);
|
||||||
|
Loading…
Reference in New Issue
Block a user