|
FastLED 3.10.8
|
Functions to limit the power used by FastLED.
Definition in file power_mgt.h.
#include "fl/system/fastled.h"#include "pixeltypes.h"#include "fl/gfx/rgbw.h"#include "fl/channels/cled_controller.h"#include "fl/stl/noexcept.h"
Include dependency graph for power_mgt.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| struct | PowerModelRGB |
| RGB LED power consumption model Used for standard 3-channel LEDs (WS2812, WS2812B, APA102, etc.) More... | |
| struct | PowerModelRGBW |
| RGBW LED power consumption model Used for 4-channel LEDs (SK6812 RGBW and similar). More... | |
| struct | PowerModelRGBWW |
| RGBWW LED power consumption model (RGB + warm white + cool white). More... | |
Functions | |
| fl::u32 | calculate_unscaled_emitter_power_mW (fl::span< const fl::u8 > codes, fl::u8 emitter_count) FL_NO_EXCEPT |
| Charge already-solved physical output bytes in source emitter order: RGB, RGBW, or RGB + warm white + cool white. | |
| PowerModelRGB | get_power_model () FL_NO_EXCEPT |
| Get current RGB power model. | |
| float | get_power_scaling_exponent () FL_NO_EXCEPT |
| Get the current brightness-to-power response exponent. | |
| fl::u8 | get_white_emitter_mW () FL_NO_EXCEPT |
| The white-emitter draw the caller declared, or zero if they declared only an RGB model. | |
| void | set_power_model (const PowerModelRGB &model) FL_NO_EXCEPT |
| Set custom RGB LED power consumption model. | |
| void | set_power_model (const PowerModelRGBW &model) FL_NO_EXCEPT |
| Set custom RGBW LED power consumption model. | |
| void | set_power_model (const PowerModelRGBWW &model) FL_NO_EXCEPT |
| Set custom RGBWW LED power consumption model. | |
| void | set_power_scaling_exponent (float exponent) FL_NO_EXCEPT |
| Set a non-linear brightness-to-power response exponent. | |
Power Control Setup Functions | |
Functions to initialize the power control system | |
| void | set_max_power_in_milliwatts (fl::u32 powerInmW) FL_NO_EXCEPT |
| Set the maximum power used in watts. | |
| void | set_max_power_in_volts_and_milliamps (fl::u8 volts, fl::u32 milliamps) FL_NO_EXCEPT |
| Set the maximum power used in milliamps for a given voltage. | |
| void | set_max_power_indicator_LED (fl::u8 pinNumber) FL_NO_EXCEPT |
| Select a pin with an LED that will be flashed to indicate that power management is pulling down the brightness. | |
Power Control 'show()' and 'delay()' Functions | |
Power-limiting replacements of These are drop-in replacements for CFastLED::show() and CFastLED::delay(). In order to use these, you have to actually replace your calls to CFastLED::show() and CFastLED::delay() with these two functions.
| |
| void | delay_at_max_brightness_for_power (fl::u16 ms) FL_NO_EXCEPT |
| Similar to CFastLED::delay(), but pre-adjusts brightness to keep below the power threshold. | |
| void | show_at_max_brightness_for_power () FL_NO_EXCEPT |
| Similar to CFastLED::show(), but pre-adjusts brightness to keep below the power threshold. | |
Power Control Internal Helper Functions | |
Internal helper functions for power control. | |
| fl::u8 | calculate_max_brightness_for_power_mW (const CRGB *ledbuffer, fl::u16 numLeds, fl::u8 target_brightness, fl::u32 max_power_mW) FL_NO_EXCEPT |
| Determines the highest brightness level you can use and still stay under the specified power budget for a given set of LEDs. | |
| fl::u8 | calculate_max_brightness_for_power_mW (fl::u8 target_brightness, fl::u32 max_power_mW) FL_NO_EXCEPT |
| Determines the highest brightness level you can use and still stay under the specified power budget for all sets of LEDs. | |
| fl::u8 | calculate_max_brightness_for_power_vmA (const CRGB *ledbuffer, fl::u16 numLeds, fl::u8 target_brightness, fl::u32 max_power_V, fl::u32 max_power_mA) FL_NO_EXCEPT |
| Determines the highest brightness level you can use and still stay under the specified power budget for a given set of LEDs. | |
| fl::u32 | calculate_unscaled_power_mW (const CRGB *ledbuffer, fl::u16 numLeds) FL_NO_EXCEPT |
| Determines how many milliwatts the current LED data would draw at max brightness (255) | |
| fl::u32 | calculate_unscaled_power_mW (fl::span< const CRGB > leds) FL_NO_EXCEPT |
| Determines how many milliwatts the current LED data would draw at max brightness (255) | |
| fl::u32 | calculate_unscaled_power_mW (fl::span< const CRGB > leds, const fl::Rgbw &rgbw) FL_NO_EXCEPT |
| Same, for a strip driven through the RGBW conversion. | |
| fl::u32 | controller_dither_reserve_mW (const fl::CLEDController &controller) FL_NO_EXCEPT |
dither_reserve_mW() for a controller that dithers, and zero for one that does not: a mode other than BINARY_DITHER, or an active RGBW/RGBWW conversion (which reads the raw pixel on every non-AVR target). | |
| fl::u32 | controller_unscaled_power_mW (const fl::CLEDController &controller) FL_NO_EXCEPT |
| One controller's demand at full brightness, in mW, including idle draw – the quantity the limiter sums and scales. | |
| fl::u32 | dither_reserve_mW (fl::span< const CRGB > leds) FL_NO_EXCEPT |
The most BINARY_DITHER can add to one latched frame of leds, in mW (#4342, contract R4: "quantization reserve"). | |
| fl::u32 | power_ratio_of_255 (fl::u32 num, fl::u32 den) FL_NO_EXCEPT |
| min(255, floor(255 * num / den)) for den > 0, computed in 32-bit arithmetic. | |
| fl::u32 | scale_power_for_brightness (fl::u32 total_mW, fl::u8 brightness) FL_NO_EXCEPT |
| Applies the configured power-scaling response to a total power value. | |