exclude HUB75 from auto brightness limiter

For a 64x64 panel, ABL assumes 4A of standby current. This does not make any sense.
This commit is contained in:
Frank
2024-09-22 17:07:26 +02:00
parent 3a638bb396
commit ffc9ec3cfb
4 changed files with 20 additions and 3 deletions

View File

@@ -963,6 +963,7 @@ class WS2812FX { // 96 bytes
ablMilliampsMax,
currentMilliamps,
getLengthPhysical(void) const,
getLengthPhysical2(void) const, // WLEDMM total length including HUB75, network busses excluded
__attribute__((pure)) getLengthTotal(void) const, // will include virtual/nonexistent pixels in matrix //WLEDMM attribute added
getFps() const;

View File

@@ -1985,7 +1985,8 @@ void WS2812FX::estimateCurrentAndLimitBri() {
for (uint_fast8_t bNum = 0; bNum < busses.getNumBusses(); bNum++) {
Bus *bus = busses.getBus(bNum);
if (bus->getType() >= TYPE_NET_DDP_RGB) continue; //exclude non-physical network busses
auto btype = bus->getType();
if (EXCLUDE_FROM_ABL(btype)) continue; // WLEDMM exclude non-ABL and network busses
uint16_t len = bus->getLength();
uint32_t busPowerSum = 0;
for (uint_fast16_t i = 0; i < len; i++) { //sum up the usage of each LED
@@ -2196,7 +2197,20 @@ uint16_t WS2812FX::getLengthPhysical(void) const { // WLEDMM fast int types
uint_fast16_t len = 0;
for (unsigned b = 0; b < busses.getNumBusses(); b++) { // WLEDMM use native (fast) types
Bus *bus = busses.getBus(b);
if (bus->getType() >= TYPE_NET_DDP_RGB) continue; //exclude non-physical network busses
auto btype = bus->getType();
if (EXCLUDE_FROM_ABL(btype)) continue; //exclude HUB75, and non-physical network busses
len += bus->getLength();
}
return len;
}
//WLEDMM - getLengthPhysical plus plysical busses not supporting ABL (i.e. HUB75)
uint16_t WS2812FX::getLengthPhysical2(void) const {
uint_fast16_t len = 0;
for (unsigned b = 0; b < busses.getNumBusses(); b++) {
Bus *bus = busses.getBus(b);
auto btype = bus->getType();
if (IS_VIRTUAL(btype)) continue;
len += bus->getLength();
}
return len;

View File

@@ -257,6 +257,8 @@
#define IS_PWM(t) ((t) > 40 && (t) < 46)
#define NUM_PWM_PINS(t) ((t) - 40) //for analog PWM 41-45 only
#define IS_2PIN(t) ((t) > 47)
#define IS_VIRTUAL(t) ( ((t) <= TYPE_RESERVED) || (((t) >= TYPE_NET_DDP_RGB) && ((t) < (TYPE_NET_DDP_RGB + 16))) ) // WLEDMM 80..95 are network "virtual" busses
#define EXCLUDE_FROM_ABL(t) ( IS_VIRTUAL(t) || ( (t) >= (TYPE_HUB75MATRIX + 10) && (t) < (TYPE_HUB75MATRIX + 10))) // WLEDMM do not apply ato-brightness-limiter on these bus types
//Color orders
#define COL_ORDER_GRB 0 //GRB(w),defaut

View File

@@ -904,7 +904,7 @@ void serializeInfo(JsonObject root)
JsonObject leds = root.createNestedObject("leds");
leds[F("count")] = strip.getLengthTotal();
leds[F("countP")] = strip.getLengthPhysical(); //WLEDMM
leds[F("countP")] = strip.getLengthPhysical2(); //WLEDMM - getLengthPhysical plus plysical busses not supporting ABL (i.e. HUB75)
leds[F("pwr")] = strip.currentMilliamps;
leds["fps"] = strip.getFps();
leds[F("maxpwr")] = (strip.currentMilliamps)? strip.ablMilliampsMax : 0;