The most BINARY_DITHER can add to one latched frame of leds, in mW (#4342, contract R4: "quantization reserve").
Dither is applied before scaling and only ever raises a lit channel – dither() is b ? qadd8(b, d) : 0 – by up to two output codes at any non-zero brightness (the offset d <= 256/s is scaled back by s, and the FASTLED_SCALE8_FIXED rounding can carry once more). So the reserve is two codes on every lit channel, at the power model's steepest single-code step, rounded up. It does not scale with brightness, which is why the limiter adds it to the fixed part of the demand rather than the scaled part.
Definition at line 485 of file power_mgt.cpp.hpp.
485 {
486 fl::u32 lit_r = 0, lit_g = 0, lit_b = 0;
487 for (fl::size i = 0; i <
leds.size(); ++i) {
488
489 lit_r +=
leds[i].r != 0 ? 1u : 0u;
490 lit_g +=
leds[i].g != 0 ? 1u : 0u;
491 lit_b +=
leds[i].b != 0 ? 1u : 0u;
492 }
494 const fl::u64 per_code =
495 static_cast<fl::u64
>(lit_r) * model.
red_mW +
496 static_cast<fl::u64
>(lit_g) * model.
green_mW +
497 static_cast<fl::u64
>(lit_b) * model.
blue_mW;
498
499
501 const fl::u64 reserve = (scaled + 255) >> 8;
502
503
504 return reserve > 0xFFFFFFFFu ? 0xFFFFFFFFu : static_cast<fl::u32>(reserve);
505}
static constexpr fl::u32 kDitherReserveCodes
static fl::u8 max_power_step()
What one output code can cost at the steepest point of the response, in the 0-255 scaled units calcul...
static PowerModelRGB & gPowerModel()
Global RGB power model (initialized to WS2812 @ 5V defaults, linear response)
fl::u8 blue_mW
Blue channel power at full brightness (255), in milliwatts.
fl::u8 red_mW
Red channel power at full brightness (255), in milliwatts.
fl::u8 green_mW
Green channel power at full brightness (255), in milliwatts.
RGB LED power consumption model Used for standard 3-channel LEDs (WS2812, WS2812B,...
References PowerModelRGB::blue_mW, gPowerModel(), PowerModelRGB::green_mW, kDitherReserveCodes, leds, max_power_step(), and PowerModelRGB::red_mW.
Referenced by controller_dither_reserve_mW().