adding getPixelColorRestored()

similar to getPixelColor, but returns the original pixel without brightness adjustments.

* getPixelColorRestored is used by segment::sPC and segment::gPC
* getPixelColor is still used by ABL (auto brightness limiter)
This commit is contained in:
Frank
2024-09-28 02:43:12 +02:00
parent b245112d2a
commit 2aa0d47036
6 changed files with 68 additions and 2 deletions

View File

@@ -1304,7 +1304,7 @@ uint32_t __attribute__((hot)) Segment::getPixelColor(int i) const
if (offset < INT16_MAX) i += offset; // WLEDMM
if ((i >= stop) && (stop>0)) i -= length(); // WLEDMM avoid negative index (stop = 0 is a possible value)
if (i<0) i=0; // WLEDMM just to be 100% sure
return strip.getPixelColor(i);
return strip.getPixelColorRestored(i);
}
uint8_t Segment::differs(Segment& b) const {
@@ -1943,6 +1943,12 @@ uint32_t WS2812FX::getPixelColor(uint_fast16_t i) const // WLEDMM fast int types
return busses.getPixelColor(i);
}
uint32_t WS2812FX::getPixelColorRestored(uint_fast16_t i) const // WLEDMM gets the original color from the driver (without downscaling by _bri)
{
if (i < customMappingSize) i = customMappingTable[i];
if (i >= _length) return 0;
return busses.getPixelColorRestored(i);
}
//DISCLAIMER
//The following function attemps to calculate the current LED power usage,