FastLED 3.9.3
Loading...
Searching...
No Matches
Power Management Functions

Detailed Description

Functions to limit the amount of power used by FastLED

Power Control Setup Functions

Functions to initialize the power control system

void set_max_power_in_volts_and_milliamps (uint8_t volts, uint32_t milliamps)
 Set the maximum power used in milliamps for a given voltage.
 
void set_max_power_in_milliwatts (uint32_t powerInmW)
 Set the maximum power used in watts.
 
void set_max_power_indicator_LED (uint8_t pinNumber)
 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 show() and delay().

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.

Deprecated
These functions are deprecated as of 6ebcb64, circa 2015. Do not use them for new programs.
void show_at_max_brightness_for_power ()
 Similar to CFastLED::show(), but pre-adjusts brightness to keep below the power threshold.
 
void delay_at_max_brightness_for_power (uint16_t ms)
 Similar to CFastLED::delay(), but pre-adjusts brightness to keep below the power threshold.
 

Power Control Internal Helper Functions

Internal helper functions for power control.

uint32_t calculate_unscaled_power_mW (const CRGB *ledbuffer, uint16_t numLeds)
 Determines how many milliwatts the current LED data would draw at max brightness (255)
 
uint8_t calculate_max_brightness_for_power_mW (const CRGB *ledbuffer, uint16_t numLeds, uint8_t target_brightness, uint32_t max_power_mW)
 Determines the highest brightness level you can use and still stay under the specified power budget for a given set of LEDs.
 
uint8_t calculate_max_brightness_for_power_vmA (const CRGB *ledbuffer, uint16_t numLeds, uint8_t target_brightness, uint32_t max_power_V, uint32_t max_power_mA)
 Determines the highest brightness level you can use and still stay under the specified power budget for a given set of LEDs.
 
uint8_t calculate_max_brightness_for_power_mW (uint8_t target_brightness, uint32_t max_power_mW)
 Determines the highest brightness level you can use and still stay under the specified power budget for all sets of LEDs.
 

Function Documentation

◆ calculate_max_brightness_for_power_mW() [1/2]

uint8_t calculate_max_brightness_for_power_mW ( const CRGB * ledbuffer,
uint16_t numLeds,
uint8_t target_brightness,
uint32_t max_power_mW )

Determines the highest brightness level you can use and still stay under the specified power budget for a given set of LEDs.

Parameters
ledbufferthe LED data to check
numLedsthe number of LEDs in the data array
target_brightnessthe brightness you'd ideally like to use
max_power_mWthe max power draw desired, in milliwatts
Returns
a limited brightness value. No higher than the target brightness, but may be lower depending on the power limit.

Definition at line 95 of file power_mgt.cpp.

◆ calculate_max_brightness_for_power_mW() [2/2]

uint8_t calculate_max_brightness_for_power_mW ( uint8_t target_brightness,
uint32_t max_power_mW )

Determines the highest brightness level you can use and still stay under the specified power budget for all sets of LEDs.

Unlike the other internal power functions which use a pointer to a specific set of LED data, this function uses the CFastLED linked list of LED controllers and their attached data.

Parameters
target_brightnessthe brightness you'd ideally like to use
max_power_mWthe max power draw desired, in milliwatts
Returns
a limited brightness value. No higher than the target brightness, but may be lower depending on the power limit.

Definition at line 111 of file power_mgt.cpp.

◆ calculate_max_brightness_for_power_vmA()

uint8_t calculate_max_brightness_for_power_vmA ( const CRGB * ledbuffer,
uint16_t numLeds,
uint8_t target_brightness,
uint32_t max_power_V,
uint32_t max_power_mA )

Determines the highest brightness level you can use and still stay under the specified power budget for a given set of LEDs.

Parameters
ledbufferthe LED data to check
numLedsthe number of LEDs in the data array
target_brightnessthe brightness you'd ideally like to use
max_power_Vthe max power in volts
max_power_mAthe max power in milliamps
Returns
a limited brightness value. No higher than the target brightness, but may be lower depending on the power limit.

Definition at line 91 of file power_mgt.cpp.

◆ calculate_unscaled_power_mW()

uint32_t calculate_unscaled_power_mW ( const CRGB * ledbuffer,
uint16_t numLeds )

Determines how many milliwatts the current LED data would draw at max brightness (255)

Parameters
ledbufferthe LED data to check
numLedsthe number of LEDs in the data array
Returns
the number of milliwatts the LED data would consume at max brightness

Definition at line 61 of file power_mgt.cpp.

◆ delay_at_max_brightness_for_power()

void delay_at_max_brightness_for_power ( uint16_t ms)

Similar to CFastLED::delay(), but pre-adjusts brightness to keep below the power threshold.

Deprecated
This is now a part of CFastLED::delay()

Definition at line 191 of file power_mgt.cpp.

◆ set_max_power_in_milliwatts()

void set_max_power_in_milliwatts ( uint32_t powerInmW)

Set the maximum power used in watts.

Deprecated
Use CFastLED::setMaxPowerInMilliWatts

Definition at line 180 of file power_mgt.cpp.

◆ set_max_power_in_volts_and_milliamps()

void set_max_power_in_volts_and_milliamps ( uint8_t volts,
uint32_t milliamps )

Set the maximum power used in milliamps for a given voltage.

Deprecated
Use CFastLED::setMaxPowerInVoltsAndMilliamps()

Definition at line 175 of file power_mgt.cpp.

◆ set_max_power_indicator_LED()

void set_max_power_indicator_LED ( uint8_t pinNumber)

Select a pin with an LED that will be flashed to indicate that power management is pulling down the brightness.

Parameters
pinNumberoutput pin. Zero is "no indicator LED".

Definition at line 170 of file power_mgt.cpp.

◆ show_at_max_brightness_for_power()

void show_at_max_brightness_for_power ( )

Similar to CFastLED::show(), but pre-adjusts brightness to keep below the power threshold.

Deprecated
This is now a part of CFastLED::show()

Definition at line 185 of file power_mgt.cpp.