Get estimated power consumption in milliwatts.
Calculates the estimated power consumption based on current LED buffer contents, brightness setting, and configured power model. This provides visibility into power usage for monitoring and debugging.
- Parameters
-
| apply_limiter | If true (default), applies power limiting to calculate actual power. If false, returns requested power before limiting. |
- Returns
- Estimated LED power consumption in milliwatts:
- apply_limiter=true: Power AFTER applying max-power cap (actual power)
- apply_limiter=false: Power BEFORE limiting (requested power)
- Note
- Usage examples:
fl::u32 actual =
FastLED.getEstimatedPowerInMilliWatts();
fl::u32 requested =
FastLED.getEstimatedPowerInMilliWatts(
false);
CFastLED FastLED
Global LED strip management instance.
-
When apply_limiter=true:
- If power limiting is NOT enabled, returns unrestricted power
- If power limiting IS enabled, returns power after brightness reduction
-
MCU power consumption is NOT included in this calculation. Add your platform-specific MCU power separately:
fl::u32 mcu_power_mW = 25 * 5;
fl::u32 total_power =
FastLED.getEstimatedPowerInMilliWatts() + mcu_power_mW;
-
Uses the configured power-scaling response. Default is linear scaling; use
model.exponent via setPowerModel() or the setPowerScalingExponent() convenience wrapper to enable a non-linear model.
- See also
- setMaxPowerInMilliWatts()
-
setPowerModel()
-
setPowerScalingExponent()
Definition at line 415 of file FastLED.cpp.hpp.
415 {
416 fl::u32 total_power_mW = 0;
417
418
422 }
423 });
424
425
427
429
430
432 }
433
434
435
437}
power_func mPPowerFunc
function for overriding brightness when using FastLED.show();
CRGB * leds()
Get a pointer to led data for the first controller.
fl::u8 mScale
the current global brightness scale setting
fl::u32 mNPowerData
max power use parameter
static void visitControllers(Visitor &&visitor) FL_NOEXCEPT
Visit all controllers in the linked list with a visitor The visitor must be a callable that accepts (...
fl::CLEDController CLEDController
fl::u32 scale_power_for_brightness(fl::u32 total_mW, fl::u8 brightness)
Applies the configured power-scaling response to a total power value.
fl::u32 calculate_unscaled_power_mW(fl::span< const CRGB > leds)
References calculate_unscaled_power_mW(), leds(), mNPowerData, mPPowerFunc, mScale, scale_power_for_brightness(), and fl::CLEDController::visitControllers().