MCPcopy Create free account
hub / github.com/FastLED/FastLED / PowerModelRGB

Class PowerModelRGB

src/power_mgt.h:27–51  ·  view source on GitHub ↗

RGB LED power consumption model Used for standard 3-channel LEDs (WS2812, WS2812B, APA102, etc.) The model carries the brightness-to-power response exponent alongside the per-channel draw so the scaling behavior travels with the model and can be set in a single `set_power_model(...)` call.

Source from the content-addressed store, hash-verified

25/// the per-channel draw so the scaling behavior travels with the model and
26/// can be set in a single `set_power_model(...)` call.
27struct PowerModelRGB {
28 fl::u8 red_mW; ///< Red channel power at full brightness (255), in milliwatts
29 fl::u8 green_mW; ///< Green channel power at full brightness (255), in milliwatts
30 fl::u8 blue_mW; ///< Blue channel power at full brightness (255), in milliwatts
31 fl::u8 dark_mW; ///< Dark LED baseline power consumption, in milliwatts
32 float exponent; ///< Brightness-to-power response exponent (1.0 = linear)
33
34 /// Default constructor - WS2812 @ 5V (16mA/11mA/15mA @ 5V), linear response
35 constexpr PowerModelRGB()
36 : red_mW(5 * 16), green_mW(5 * 11), blue_mW(5 * 15), dark_mW(5 * 1),
37 exponent(1.0f) {}
38
39 /// Custom RGB power model
40 /// @param r Red channel power (mW)
41 /// @param g Green channel power (mW)
42 /// @param b Blue channel power (mW)
43 /// @param d Dark state power (mW)
44 /// @param e Brightness-to-power response exponent. 1.0 = linear (default),
45 /// values < 1.0 model higher-than-linear draw at mid brightness,
46 /// values > 1.0 model lower-than-linear draw. Non-positive or
47 /// near-1.0 values fall back to linear. Only honored on large-memory
48 /// targets; ignored where `SKETCH_HAS_LARGE_MEMORY==0`.
49 constexpr PowerModelRGB(fl::u8 r, fl::u8 g, fl::u8 b, fl::u8 d, float e = 1.0f)
50 : red_mW(r), green_mW(g), blue_mW(b), dark_mW(d), exponent(e) {}
51};
52
53/// RGBW LED power consumption model
54/// @note Future API enhancement - not yet implemented in power calculations

Callers 4

toRGBMethod · 0.85
toRGBMethod · 0.85
FL_TEST_FILEFunction · 0.85
reset_to_defaultMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected