strip level setPixelColor and getPixelColor optimization

* moved sPC and gPC functions out of their .cpp files into FX.h, so the compiler can optimize better.

depending of effect used, this gives a 2% up to 8% speedup.
This commit is contained in:
Frank
2025-11-01 16:50:20 +01:00
parent 297a2c2b9c
commit 40064490ad
3 changed files with 97 additions and 71 deletions

View File

@@ -1969,26 +1969,11 @@ void WS2812FX::service() {
_isServicing = false;
}
void IRAM_ATTR WS2812FX::setPixelColor(int i, uint32_t col)
{
if (i < customMappingSize) i = customMappingTable[i];
if (i >= _length) return;
busses.setPixelColor(i, col);
}
uint32_t WS2812FX::getPixelColor(uint_fast16_t i) const // WLEDMM fast int types
{
if (i < customMappingSize) i = customMappingTable[i];
if (i >= _length) return 0;
return busses.getPixelColor(i);
}
// WLEDMM: WS2812FX::setPixelColor() moved FX.h for speed (inlining)
// WLEDMM: WS2812FX::getPixelColor() moved FX.h for speed (inlining)
// WLEDMM: WS2812FX::getPixelColorRestored() moved FX.h for speed (inlining)
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,