From a80fe6ed0f655d05277e34cc79a97d34287cba77 Mon Sep 17 00:00:00 2001 From: hntirgeam <56179857+hntirgeam@users.noreply.github.com> Date: Thu, 1 Jan 2026 20:52:10 +0100 Subject: [PATCH 1/7] Added power calculation in API for smarthome integrations --- wled00/bus_manager.cpp | 87 +++++++++++++++++++++-------------- wled00/bus_manager.h | 7 +++ wled00/cfg.cpp | 3 ++ wled00/const.h | 4 ++ wled00/data/settings_leds.htm | 20 ++++---- wled00/json.cpp | 3 ++ wled00/set.cpp | 3 ++ wled00/xml.cpp | 1 + 8 files changed, 86 insertions(+), 42 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 4fa5c40a57..45f7de2d61 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -293,8 +293,9 @@ void IRAM_ATTR BusDigital::setPixelColor(unsigned pix, uint32_t c) { if (Bus::_cct >= 1900) c = colorBalanceFromKelvin(Bus::_cct, c); //color correction from CCT c = color_fade(c, _bri, true); // apply brightness - if (BusManager::_useABL) { - // if using ABL, sum all color channels to estimate current and limit brightness in show() + // Always sum color channels for power monitoring (used for ABL and power consumption tracking) + // Only skip if LED current is not configured (0mA per led) + if (_milliAmpsPerLed > 0) { uint8_t r = R(c), g = G(c), b = B(c); if (_milliAmpsPerLed < 255) { // normal ABL _colorSum += r + g + b + W(c); @@ -360,6 +361,10 @@ size_t BusDigital::getBusSize() const { return sizeof(BusDigital) + (isOk() ? PolyBus::getDataSize(_busPtr, _iType) : 0); // does not include common I2S DMA buffer } +float BusDigital::getVoltage() const { + return BusManager::getVoltage(); +} + void BusDigital::setColorOrder(uint8_t colorOrder) { // upper nibble contains W swap information if ((colorOrder & 0x0F) > 5) return; @@ -1393,46 +1398,59 @@ void BusManager::initializeABL() { } void BusManager::applyABL() { - if (_useABL) { - unsigned milliAmpsSum = 0; // use temporary variable to always return a valid _gMilliAmpsUsed to UI - unsigned totalLEDs = 0; + // Always estimate current for monitoring, but only apply limiting when ABL is enabled + unsigned milliAmpsSum = 0; + unsigned totalLEDs = 0; + + for (auto &bus : busses) { + if (bus->isDigital() && bus->isOk()) { + BusDigital &busd = static_cast(*bus); + busd.estimateCurrent(); // sets _milliAmpsTotal, current is estimated for all buses even if they have the limit set to 0 + if (_useABL && _gMilliAmpsMax == 0) + busd.applyBriLimit(0); // apply per bus ABL limit, updates _milliAmpsTotal if limit reached + milliAmpsSum += busd.getUsedCurrent(); + totalLEDs += busd.getLength(); // sum total number of LEDs for global Limit + } + } + + // Apply brightness limiting only when ABL is enabled + if (_useABL && _gMilliAmpsMax > 0) { + uint8_t newBri = 255; + uint32_t globalMax = _gMilliAmpsMax > MA_FOR_ESP ? _gMilliAmpsMax - MA_FOR_ESP : 1; // subtract ESP current consumption, fully limit if too low + if (globalMax > totalLEDs) { // check if budget is larger than standby current + if (milliAmpsSum > globalMax) { + newBri = globalMax * 255 / milliAmpsSum + 1; // scale brightness down to stay in current limit, +1 to avoid 0 brightness + milliAmpsSum = globalMax; // update total used current + } + } else { + newBri = 1; // limit too low, set brightness to minimum + milliAmpsSum = totalLEDs; // estimate total used current as minimum + } + + // apply brightness limit to each bus, if its 255 it will only reset _colorSum for (auto &bus : busses) { if (bus->isDigital() && bus->isOk()) { BusDigital &busd = static_cast(*bus); - busd.estimateCurrent(); // sets _milliAmpsTotal, current is estimated for all buses even if they have the limit set to 0 - if (_gMilliAmpsMax == 0) - busd.applyBriLimit(0); // apply per bus ABL limit, updates _milliAmpsTotal if limit reached - milliAmpsSum += busd.getUsedCurrent(); - totalLEDs += busd.getLength(); // sum total number of LEDs for global Limit + if (busd.getLEDCurrent() > 0) // skip buses with LED current set to 0 + busd.applyBriLimit(newBri); } } - // check global current limit and apply global ABL limit, total current is summed above - if (_gMilliAmpsMax > 0) { - uint8_t newBri = 255; - uint32_t globalMax = _gMilliAmpsMax > MA_FOR_ESP ? _gMilliAmpsMax - MA_FOR_ESP : 1; // subtract ESP current consumption, fully limit if too low - if (globalMax > totalLEDs) { // check if budget is larger than standby current - if (milliAmpsSum > globalMax) { - newBri = globalMax * 255 / milliAmpsSum + 1; // scale brightness down to stay in current limit, +1 to avoid 0 brightness - milliAmpsSum = globalMax; // update total used current - } - } else { - newBri = 1; // limit too low, set brightness to minimum - milliAmpsSum = totalLEDs; // estimate total used current as minimum - } - - // apply brightness limit to each bus, if its 255 it will only reset _colorSum - for (auto &bus : busses) { - if (bus->isDigital() && bus->isOk()) { - BusDigital &busd = static_cast(*bus); - if (busd.getLEDCurrent() > 0) // skip buses with LED current set to 0 - busd.applyBriLimit(newBri); - } + } else { + // ABL is disabled, but we still need to reset _colorSum for next frame + for (auto &bus : busses) { + if (bus->isDigital() && bus->isOk()) { + BusDigital &busd = static_cast(*bus); + if (busd.getLEDCurrent() > 0) // skip buses with LED current set to 0 + busd.applyBriLimit(255); // 255 = no limiting, just reset _colorSum } } - _gMilliAmpsUsed = milliAmpsSum; } - else - _gMilliAmpsUsed = 0; // reset, we have no current estimation without ABL + + _gMilliAmpsUsed = milliAmpsSum; // always update current usage for monitoring +} + +float BusManager::currentWatts() { + return (currentMilliamps() * _gVoltage) / 1000.0; } ColorOrderMap& BusManager::getColorOrderMap() { return _colorOrderMap; } @@ -1450,4 +1468,5 @@ uint16_t BusDigital::_milliAmpsTotal = 0; std::vector> BusManager::busses; uint16_t BusManager::_gMilliAmpsUsed = 0; uint16_t BusManager::_gMilliAmpsMax = ABL_MILLIAMPS_DEFAULT; +uint8_t BusManager::_gVoltage = LED_VOLTAGE_DEFAULT; bool BusManager::_useABL = false; diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 95772a443f..3bee292b2f 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -140,6 +140,7 @@ class Bus { virtual uint16_t getLEDCurrent() const { return 0; } virtual uint16_t getUsedCurrent() const { return 0; } virtual uint16_t getMaxCurrent() const { return 0; } + virtual float getVoltage() const { return LED_VOLTAGE_DEFAULT; } virtual size_t getBusSize() const { return sizeof(Bus); } virtual const String getCustomText() const { return String(); } @@ -258,6 +259,7 @@ class BusDigital : public Bus { uint16_t getLEDCurrent() const override { return _milliAmpsPerLed; } uint16_t getUsedCurrent() const override { return _milliAmpsTotal; } uint16_t getMaxCurrent() const override { return _milliAmpsMax; } + float getVoltage() const override; void setCurrentLimit(uint16_t milliAmps) { _milliAmpsLimit = milliAmps; } void estimateCurrent(); // estimate used current from summed colors void applyBriLimit(uint8_t newBri); @@ -480,6 +482,7 @@ namespace BusManager { //extern std::vector busses; extern uint16_t _gMilliAmpsUsed; extern uint16_t _gMilliAmpsMax; + extern uint8_t _gVoltage; extern bool _useABL; #ifdef ESP32_DATA_IDLE_HIGH @@ -496,6 +499,10 @@ namespace BusManager { //inline uint16_t ablMilliampsMax() { unsigned sum = 0; for (auto &bus : busses) sum += bus->getMaxCurrent(); return sum; } inline uint16_t ablMilliampsMax() { return _gMilliAmpsMax; } // used for compatibility reasons (and enabling virtual global ABL) inline void setMilliampsMax(uint16_t max) { _gMilliAmpsMax = max;} + inline uint8_t getVoltage() { return _gVoltage; } + inline void setVoltage(uint8_t v) { _gVoltage = v; } + float currentWatts(); // calculate total power consumption in Watts + inline float ablWattsMax() { return (_gMilliAmpsMax * _gVoltage) / 1000.0; } void initializeABL(); // setup automatic brightness limiter parameters, call once after buses are initialized void applyABL(); // apply automatic brightness limiter, global or per bus diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index e30be759b6..8bc1b91471 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -158,6 +158,8 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { uint16_t total = hw_led[F("total")] | strip.getLengthTotal(); uint16_t ablMilliampsMax = hw_led[F("maxpwr")] | BusManager::ablMilliampsMax(); BusManager::setMilliampsMax(ablMilliampsMax); + uint8_t ledVoltage = hw_led[F("voltage")] | LED_VOLTAGE_DEFAULT; + BusManager::setVoltage(ledVoltage); Bus::setGlobalAWMode(hw_led[F("rgbwm")] | AW_GLOBAL_DISABLED); CJSON(strip.correctWB, hw_led["cct"]); CJSON(strip.cctFromRgb, hw_led[F("cr")]); @@ -921,6 +923,7 @@ void serializeConfig(JsonObject root) { JsonObject hw_led = hw.createNestedObject("led"); hw_led[F("total")] = strip.getLengthTotal(); //provided for compatibility on downgrade and per-output ABL hw_led[F("maxpwr")] = BusManager::ablMilliampsMax(); + hw_led[F("voltage")] = BusManager::getVoltage(); // hw_led[F("ledma")] = 0; // no longer used hw_led["cct"] = strip.correctWB; hw_led[F("cr")] = strip.cctFromRgb; diff --git a/wled00/const.h b/wled00/const.h index 9067d9b16c..9226ac34d5 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -536,6 +536,10 @@ static_assert(WLED_MAX_BUSSES <= 32, "WLED_MAX_BUSSES exceeds hard limit"); #endif #endif +#ifndef LED_VOLTAGE_DEFAULT + #define LED_VOLTAGE_DEFAULT 5 // 5V is most common for WS281x +#endif + // PWM settings #ifndef WLED_PWM_FREQ #ifdef ESP8266 diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 2cd5e28393..f355b0b00e 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -172,11 +172,10 @@ // enable and update LED Amps function enLA(s,n) { - const abl = d.Sf.ABL.checked; const t = parseInt(d.Sf["LT"+n].value); // LED type SELECT gId('LAdis'+n).style.display = s.selectedIndex==5 ? "inline" : "none"; // show/hide custom mA field if (s.value!=="0") d.Sf["LA"+n].value = s.value; // set value from select object - d.Sf["LA"+n].min = (!isDig(t) || !abl) ? 0 : 1; // set minimum value for validation + d.Sf["LA"+n].min = (!isDig(t)) ? 0 : 1; // set minimum value for validation (required for power monitoring) } function setABL() { @@ -287,11 +286,11 @@ memu += getMem(t, n); // calc memory dC += (isDig(t) && !isD2P(t)); setPinConfig(n,t); - gId("abl"+n).style.display = (!abl || !isDig(t)) ? "none" : "inline"; // show/hide individual ABL settings + gId("dig"+n+"ma").style.display = isDig(t) ? "inline" : "none"; // show mA/LED for digital LEDs (for power monitoring) if (change) { // did we change LED type? gId("rf"+n).checked = (gId("rf"+n).checked || t == 31); // LEDs require data in off state (mandatory for TM1814) if (isAna(t)) d.Sf["LC"+n].value = 1; // for sanity change analog count just to 1 LED - d.Sf["LA"+n].min = (!isDig(t) || !abl) ? 0 : 1; // set minimum value for LED mA + d.Sf["LA"+n].min = (!isDig(t)) ? 0 : 1; // set minimum value for LED mA (always required for power monitoring) d.Sf["MA"+n].min = (!isDig(t)) ? 0 : 250; // set minimum value for PSU mA } gId("rf"+n).onclick = mustR(t) ? (()=>{return false}) : (()=>{}); // prevent change change of "Refresh" checkmark when mandatory @@ -469,8 +468,8 @@
${i+1}:
-
-mA/LED: @@ -478,9 +477,9 @@
- -
PSU: mA
+
+
PSU: mA
Color Order: V
+ Used for approximate power consumption calculations. Typical: 5V for WS281x, 12V or 24V for others
+
Enable automatic brightness limiter:
Automatically limits brightness to stay close to the limit.
diff --git a/wled00/json.cpp b/wled00/json.cpp index f23080135f..1b3034d45b 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -704,8 +704,11 @@ void serializeInfo(JsonObject root) JsonObject leds = root.createNestedObject(F("leds")); leds[F("count")] = strip.getLengthTotal(); leds[F("pwr")] = BusManager::currentMilliamps(); + leds[F("pwr_w")] = BusManager::currentWatts(); leds["fps"] = strip.getFps(); leds[F("maxpwr")] = BusManager::currentMilliamps()>0 ? BusManager::ablMilliampsMax() : 0; + leds[F("maxpwr_w")] = BusManager::ablWattsMax(); + leds[F("voltage")] = BusManager::getVoltage(); leds[F("maxseg")] = WS2812FX::getMaxSegments(); //leds[F("actseg")] = strip.getActiveSegmentsNum(); //leds[F("seglock")] = false; //might be used in the future to prevent modifications to segment config diff --git a/wled00/set.cpp b/wled00/set.cpp index 2a633bf07d..200f08978c 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -147,6 +147,9 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) unsigned ablMilliampsMax = request->arg(F("MA")).toInt(); BusManager::setMilliampsMax(ablMilliampsMax); + uint8_t ledVoltage = request->arg(F("LV")).toInt(); + if (ledVoltage > 0) BusManager::setVoltage(ledVoltage); + strip.autoSegments = request->hasArg(F("MS")); strip.correctWB = request->hasArg(F("CCT")); strip.cctFromRgb = request->hasArg(F("CR")); diff --git a/wled00/xml.cpp b/wled00/xml.cpp index 194256d82e..a2b6106b8c 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -374,6 +374,7 @@ void getSettingsJS(byte subPage, Print& settingsScript) sumMa += bus->getMaxCurrent(); } printSetFormValue(settingsScript,PSTR("MA"),BusManager::ablMilliampsMax() ? BusManager::ablMilliampsMax() : sumMa); + printSetFormValue(settingsScript,PSTR("LV"),BusManager::getVoltage()); printSetFormCheckbox(settingsScript,PSTR("ABL"),BusManager::ablMilliampsMax() || sumMa > 0); printSetFormCheckbox(settingsScript,PSTR("PPL"),!BusManager::ablMilliampsMax() && sumMa > 0); From 949e3a7f065b9cb846a09dd94c8b8ff856a453fa Mon Sep 17 00:00:00 2001 From: hntirgeam <56179857+hntirgeam@users.noreply.github.com> Date: Fri, 2 Jan 2026 07:12:26 +0100 Subject: [PATCH 2/7] Review fixes --- wled00/data/settings_leds.htm | 1 - wled00/set.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index f355b0b00e..12e92c5b8c 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -691,7 +691,6 @@ d.getElementsByName("SP"+i)[0].value = v.freq; d.getElementsByName("LA"+i)[0].value = v.ledma; d.getElementsByName("MA"+i)[0].value = v.maxpwr; - if (v.voltage) d.getElementsByName("LV"+i)[0].value = v.voltage; }); d.getElementsByName("PR")[0].checked = l.prl | 0; d.getElementsByName("MA")[0].value = l.maxpwr; diff --git a/wled00/set.cpp b/wled00/set.cpp index 200f08978c..7f87b61d27 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -148,7 +148,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) BusManager::setMilliampsMax(ablMilliampsMax); uint8_t ledVoltage = request->arg(F("LV")).toInt(); - if (ledVoltage > 0) BusManager::setVoltage(ledVoltage); + if (ledVoltage > 0 && ledVoltage <= 50) BusManager::setVoltage(ledVoltage); strip.autoSegments = request->hasArg(F("MS")); strip.correctWB = request->hasArg(F("CCT")); From c8794ec1ce0cbb809ba08b48ddbc0ce9c476fd5c Mon Sep 17 00:00:00 2001 From: hntirgeam <56179857+hntirgeam@users.noreply.github.com> Date: Fri, 2 Jan 2026 07:24:18 +0100 Subject: [PATCH 3/7] Review fixes --- wled00/data/settings_leds.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 12e92c5b8c..8f67bc3207 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -868,7 +868,7 @@

LED & Hardware setup

?


- LED Strip Voltage: V
+ LED Strip Voltage: V
Used for approximate power consumption calculations. Typical: 5V for WS281x, 12V or 24V for others

Enable automatic brightness limiter:
From 59d6190e9c618d1ce62d6d45b6448b4284855106 Mon Sep 17 00:00:00 2001 From: hntirgeam <56179857+hntirgeam@users.noreply.github.com> Date: Sun, 4 Jan 2026 03:14:00 +0100 Subject: [PATCH 4/7] Make power monitoring optional to reduce CPU usage --- wled00/bus_manager.cpp | 39 ++++++++++++++++------------------- wled00/bus_manager.h | 3 +++ wled00/cfg.cpp | 3 +++ wled00/data/settings_leds.htm | 19 ++++++++++++++--- wled00/set.cpp | 2 ++ wled00/xml.cpp | 1 + 6 files changed, 43 insertions(+), 24 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 45f7de2d61..b4db22a3e6 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -1398,7 +1398,12 @@ void BusManager::initializeABL() { } void BusManager::applyABL() { - // Always estimate current for monitoring, but only apply limiting when ABL is enabled + // Only calculate current if ABL or power monitoring is enabled + if (!_useABL && !_usePowerMonitoring) { + _gMilliAmpsUsed = 0; + return; // Skip expensive calculations when neither feature is enabled + } + unsigned milliAmpsSum = 0; unsigned totalLEDs = 0; @@ -1413,9 +1418,10 @@ void BusManager::applyABL() { } } - // Apply brightness limiting only when ABL is enabled + // Calculate brightness limit when ABL is enabled, otherwise use max brightness + uint8_t newBri = 255; // Default: no limiting + if (_useABL && _gMilliAmpsMax > 0) { - uint8_t newBri = 255; uint32_t globalMax = _gMilliAmpsMax > MA_FOR_ESP ? _gMilliAmpsMax - MA_FOR_ESP : 1; // subtract ESP current consumption, fully limit if too low if (globalMax > totalLEDs) { // check if budget is larger than standby current if (milliAmpsSum > globalMax) { @@ -1426,27 +1432,17 @@ void BusManager::applyABL() { newBri = 1; // limit too low, set brightness to minimum milliAmpsSum = totalLEDs; // estimate total used current as minimum } + } - // apply brightness limit to each bus, if its 255 it will only reset _colorSum - for (auto &bus : busses) { - if (bus->isDigital() && bus->isOk()) { - BusDigital &busd = static_cast(*bus); - if (busd.getLEDCurrent() > 0) // skip buses with LED current set to 0 - busd.applyBriLimit(newBri); - } - } - } else { - // ABL is disabled, but we still need to reset _colorSum for next frame - for (auto &bus : busses) { - if (bus->isDigital() && bus->isOk()) { - BusDigital &busd = static_cast(*bus); - if (busd.getLEDCurrent() > 0) // skip buses with LED current set to 0 - busd.applyBriLimit(255); // 255 = no limiting, just reset _colorSum - } + // Apply brightness limit to each bus (if ABL enabled) or just reset _colorSum (if power monitoring only) + for (auto &bus : busses) { + if (bus->isDigital() && bus->isOk()) { + BusDigital &busd = static_cast(*bus); + if (busd.getLEDCurrent() > 0) + busd.applyBriLimit(newBri); } } - - _gMilliAmpsUsed = milliAmpsSum; // always update current usage for monitoring + _gMilliAmpsUsed = milliAmpsSum; } float BusManager::currentWatts() { @@ -1470,3 +1466,4 @@ uint16_t BusManager::_gMilliAmpsUsed = 0; uint16_t BusManager::_gMilliAmpsMax = ABL_MILLIAMPS_DEFAULT; uint8_t BusManager::_gVoltage = LED_VOLTAGE_DEFAULT; bool BusManager::_useABL = false; +bool BusManager::_usePowerMonitoring = false; diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 3bee292b2f..31d96c9395 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -484,6 +484,7 @@ namespace BusManager { extern uint16_t _gMilliAmpsMax; extern uint8_t _gVoltage; extern bool _useABL; + extern bool _usePowerMonitoring; #ifdef ESP32_DATA_IDLE_HIGH void esp32RMTInvertIdle() ; @@ -501,6 +502,8 @@ namespace BusManager { inline void setMilliampsMax(uint16_t max) { _gMilliAmpsMax = max;} inline uint8_t getVoltage() { return _gVoltage; } inline void setVoltage(uint8_t v) { _gVoltage = v; } + inline bool getPowerMonitoring() { return _usePowerMonitoring; } + inline void setPowerMonitoring(bool pm) { _usePowerMonitoring = pm; } float currentWatts(); // calculate total power consumption in Watts inline float ablWattsMax() { return (_gMilliAmpsMax * _gVoltage) / 1000.0; } void initializeABL(); // setup automatic brightness limiter parameters, call once after buses are initialized diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 8bc1b91471..36ea542d20 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -160,6 +160,8 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { BusManager::setMilliampsMax(ablMilliampsMax); uint8_t ledVoltage = hw_led[F("voltage")] | LED_VOLTAGE_DEFAULT; BusManager::setVoltage(ledVoltage); + bool powerMonitoring = hw_led[F("pwrmon")] | false; + BusManager::setPowerMonitoring(powerMonitoring); Bus::setGlobalAWMode(hw_led[F("rgbwm")] | AW_GLOBAL_DISABLED); CJSON(strip.correctWB, hw_led["cct"]); CJSON(strip.cctFromRgb, hw_led[F("cr")]); @@ -924,6 +926,7 @@ void serializeConfig(JsonObject root) { hw_led[F("total")] = strip.getLengthTotal(); //provided for compatibility on downgrade and per-output ABL hw_led[F("maxpwr")] = BusManager::ablMilliampsMax(); hw_led[F("voltage")] = BusManager::getVoltage(); + hw_led[F("pwrmon")] = BusManager::getPowerMonitoring(); // hw_led[F("ledma")] = 0; // no longer used hw_led["cct"] = strip.correctWB; hw_led[F("cr")] = strip.cctFromRgb; diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 8f67bc3207..ee3bed6468 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -133,11 +133,19 @@ } } } + function enPM() + { + var en = d.Sf.PM.checked; + gId('pwrmon').style.display = (en) ? 'inline':'none'; + gId('pmwarn').style.display = (en && !d.Sf.ABL.checked) ? 'inline':'none'; + } function enABL() { var en = d.Sf.ABL.checked; gId('abl').style.display = (en) ? 'inline':'none'; gId('psu2').style.display = (en) ? 'inline':'none'; + // Change power monitoring warning visibility (hide if ABL is enabled - calculations already running) + if (d.Sf.PM.checked) gId('pmwarn').style.display = (!en) ? 'inline':'none'; if (!en) { // limiter disabled d.Sf.PPL.checked = false; @@ -201,6 +209,7 @@ else sel.value = 0; enLA(sel,n); // configure individual limiter }); + enPM(); enABL(); gId('m1').innerHTML = maxM; } @@ -469,7 +478,7 @@ ${i+1}: