Bugfix: saving LED settings not possible when brightness limiter disabled

--- and the "Maximum Current" field is empty or has a value below 250.
This commit is contained in:
Frank
2024-11-08 14:30:19 +01:00
parent 2e80d96400
commit 537638e5a2
3 changed files with 9 additions and 4 deletions

View File

@@ -110,8 +110,10 @@
}
function enABL()
{
var en = gId('able').checked;
const en = gId('able').checked;
d.Sf.LA.value = (en) ? laprev:0;
d.Sf.MA.min = (en) ? 250 : 0; // WLEDMM no minimum if invisble
if ((!en) && (!d.Sf.MA.value || d.Sf.MA.value<0)) d.Sf.MA.value = 0; // WLEDMM workaround when field is invisible with invalid value
gId('abl').style.display = (en) ? 'inline':'none';
gId('psu2').style.display = (en) ? 'inline':'none';
if (d.Sf.LA.value > 0) setABL();
@@ -173,6 +175,9 @@
gId('fpshelp2').style.display = ((d.Sf.FR.value > 132) && (d.Sf.FR.value < 196)) ? 'block':'none'; // WLEDMM
gId('fpshelp3').style.display = (d.Sf.FR.value > 196) ? 'block':'none'; // WLEDMM
const ablEnabled = gId('able').checked;
d.Sf.MA.min = ablEnabled ? 250 : 0; // WLEDMM no minimum if invisble
if ((!ablEnabled) && !d.Sf.MA.value) d.Sf.MA.value = 0; // WLEDMM workaround when field is blank but invisible
if (d.Sf.LA.value == 255) laprev = 12;
else if (d.Sf.LA.value > 0) laprev = d.Sf.LA.value;

View File

@@ -244,8 +244,8 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
}
touchThreshold = request->arg(F("TT")).toInt();
strip.ablMilliampsMax = request->arg(F("MA")).toInt();
strip.milliampsPerLed = request->arg(F("LA")).toInt();
strip.ablMilliampsMax = max(0L, request->arg(F("MA")).toInt());
strip.milliampsPerLed = max(0L, request->arg(F("LA")).toInt());
briS = request->arg(F("CA")).toInt();

View File

@@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2411070
#define VERSION 2411080
// WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED.
#define _MoonModules_WLED_