You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Power management doesn't take color/temp correction into account #697
area: coreLED drivers, color math, animationsdeferredTriage pass could not resolve this; skipped by ci/oldest_issue.pystatus: staleNo activity for 60+ daysstatus: triageNeeds initial assessment
The power limiting functions don't take the color correction and color temperature adjustments into account. So, worst case, if you set color correction to 255,0,0, e.g. green and blue are 100% off no matter what, and you try to show a strip of pixels that are all green, plus one red one, the power calculation assumes that the green pixels are all lit and drawing power, and thus (may) dim down the red one -- even though there is no power being drawn by the 'green' pixels.
Either calculate_max_brightness_for_power_mW should take this into account, OR CFastLED::show should take it into account, but not both.
Another stray thought: it might be nice if CFastLED::show somehow stored the last brightness or power consumption value, so that code could see what just happened, without having to re-calculate the power draw. It'd cost us a couple of bytes of SRAM, which might or might not be worth it, so I'm still just thinking about this. I suspect that since most people wouldn't use it, the burden of 're-calculating' the power draw should be on the few people who do want that reading, without a 2-byte tax on literally everyone.
Adding a stray thought of my own, could the behaviour you describe be enabled by a macro so you can opt in? Comes at the cost of more complexity and another macro for people to know about though.
Not a bad thought. I’m more tempted right now to just do the big fix now, and queue up the enhancement for the next time we do a rev to the library (and docs). But thank you for weighing in... always good to hear what sounds useful to other people.
Deferred by automated triage: Real, still-unfixed bug -- verified that color correction and temperature are applied nowhere in the power path (calculate_unscaled_power_mW at power_mgt.cpp.hpp:158 reads raw leds[i].r/g/b). Deferred because kriegsman's own framing raises an unresolved design question he never settled: 'Either calculate_max_brightness_for_power_mW should take this into account, OR CFastLED::show should take it into account, but not both.' Three complications found today: (1) there are now THREE power entry points -- the global calculate_max_brightness_for_power_mW(target,max_mW) which walks CLEDController::head() and CAN reach per-controller getCorrection()/getTemperature(), the free-function overload calculate_max_brightness_for_power_mW(ledbuffer,numLeds,...) which has NO controller context and therefore structurally cannot know the correction, and CFastLED::getEstimatedPowerInMilliWatts() (FastLED.cpp.hpp:460) which uses a visitor that currently discards the controller pointer; whichever fix lands has to decide what the context-free overload does. (2) Correction is per-controller, not global, so the fix must scale each controller's pixels by ITS OWN adjustment -- CLEDController::getAdjustmentData(brightness) returns ColorAdjustment.premixed, but that premixes brightness, which is applied separately via scale_power_for_brightness(), so using it naively double-counts brightness. (3) This changes power-limiting output for every existing user (limits relax where correction attenuates channels) -- correct, and safe in the sense that it can only track real draw more closely, but it is a behavior change to a safety-adjacent feature and wants a maintainer sign-off. Also on the issue and NOT part of the core bug: kriegsman's idea of caching the last computed power/brightness (he leaned against the 2-byte SRAM tax for everyone), and chrisparton1991's suggestion to gate the new behavior behind an opt-in macro (kriegsman was lukewarm, preferring 'the big fix').
Marking deferred — confirmed still broken, but it needs a design decision that was never made.
Verified the bug is live.calculate_unscaled_power_mW() (power_mgt.cpp.hpp:158) reads raw leds[i].r/g/b. Neither correction nor temperature is applied anywhere in the power path, so @kriegsman's worst case still holds exactly as described: correction of 255,0,0 zeroes green and blue, those pixels draw nothing, and the limiter still bills you for them.
Why not just fix it:@kriegsman's own framing contains the open question —
Either calculate_max_brightness_for_power_mW should take this into account, OR CFastLED::show should take it into account, but not both.
That was never settled, and three things found while investigating make the choice harder than it was in 2018:
1. There are now three power entry points, and they don't all have the same information.
⚠️ visitor currently discards the controller pointer
Any fix has to decide what the context-free overload does — silently stay uncorrected (so two APIs disagree), gain a parameter, or be deprecated.
2. Correction is per-controller, not global. So the fix must scale each controller's pixels by its own adjustment. CLEDController::getAdjustmentData(brightness) returns ColorAdjustment.premixed — but as the name says, that premixes brightness, and brightness is already applied separately via scale_power_for_brightness(). Using it naively double-counts brightness.
3. It changes power-limiting output for every existing user. Limits relax wherever correction attenuates a channel. That's correct — the estimate tracks real draw more closely — but power limiting is safety-adjacent, and a change that lets everyone's strips draw more current on upgrade deserves a maintainer's explicit sign-off rather than arriving in a triage sweep.
Two things on this thread that are separate from the core bug, recorded so they don't get lost:
@kriegsman's idea of caching the last computed power/brightness so callers can read it back without recomputing. He talked himself out of it in the same message — "the burden of re-calculating should be on the few people who do want that reading, without a 2-byte tax on literally everyone" — and getEstimatedPowerInMilliWatts() now covers the read-back need anyway.
@chrisparton1991's suggestion to gate the corrected behavior behind an opt-in macro. @kriegsman was lukewarm, preferring "the big fix". Worth revisiting given point 3 above — an opt-in is one way to avoid changing everyone's current draw silently.
Deferred rather than closed: the bug is real and worth fixing, it just needs someone to pick an answer to the either/or first.
area: coreLED drivers, color math, animationsdeferredTriage pass could not resolve this; skipped by ci/oldest_issue.pystatus: staleNo activity for 60+ daysstatus: triageNeeds initial assessment
Activity
chrisparton1991 commentedon Dec 12, 2018
Adding a stray thought of my own, could the behaviour you describe be enabled by a macro so you can opt in? Comes at the cost of more complexity and another macro for people to know about though.
kriegsman commentedon Dec 12, 2018
Not a bad thought. I’m more tempted right now to just do the big fix now, and queue up the enhancement for the next time we do a rev to the library (and docs). But thank you for weighing in... always good to hear what sounds useful to other people.
zackees commentedon Aug 1, 2026
Deferred by automated triage: Real, still-unfixed bug -- verified that color correction and temperature are applied nowhere in the power path (calculate_unscaled_power_mW at power_mgt.cpp.hpp:158 reads raw leds[i].r/g/b). Deferred because kriegsman's own framing raises an unresolved design question he never settled: 'Either calculate_max_brightness_for_power_mW should take this into account, OR CFastLED::show should take it into account, but not both.' Three complications found today: (1) there are now THREE power entry points -- the global calculate_max_brightness_for_power_mW(target,max_mW) which walks CLEDController::head() and CAN reach per-controller getCorrection()/getTemperature(), the free-function overload calculate_max_brightness_for_power_mW(ledbuffer,numLeds,...) which has NO controller context and therefore structurally cannot know the correction, and CFastLED::getEstimatedPowerInMilliWatts() (FastLED.cpp.hpp:460) which uses a visitor that currently discards the controller pointer; whichever fix lands has to decide what the context-free overload does. (2) Correction is per-controller, not global, so the fix must scale each controller's pixels by ITS OWN adjustment -- CLEDController::getAdjustmentData(brightness) returns ColorAdjustment.premixed, but that premixes brightness, which is applied separately via scale_power_for_brightness(), so using it naively double-counts brightness. (3) This changes power-limiting output for every existing user (limits relax where correction attenuates channels) -- correct, and safe in the sense that it can only track real draw more closely, but it is a behavior change to a safety-adjacent feature and wants a maintainer sign-off. Also on the issue and NOT part of the core bug: kriegsman's idea of caching the last computed power/brightness (he leaned against the 2-byte SRAM tax for everyone), and chrisparton1991's suggestion to gate the new behavior behind an opt-in macro (kriegsman was lukewarm, preferring 'the big fix').
zackees commentedon Aug 1, 2026
Marking deferred — confirmed still broken, but it needs a design decision that was never made.
Verified the bug is live.
calculate_unscaled_power_mW()(power_mgt.cpp.hpp:158) reads rawleds[i].r/g/b. Neither correction nor temperature is applied anywhere in the power path, so @kriegsman's worst case still holds exactly as described: correction of255,0,0zeroes green and blue, those pixels draw nothing, and the limiter still bills you for them.Why not just fix it: @kriegsman's own framing contains the open question —
That was never settled, and three things found while investigating make the choice harder than it was in 2018:
1. There are now three power entry points, and they don't all have the same information.
calculate_max_brightness_for_power_mW(target, max_mW)— walksCLEDController::head()getCorrection()/getTemperature()calculate_max_brightness_for_power_mW(ledbuffer, numLeds, ...)CFastLED::getEstimatedPowerInMilliWatts()(FastLED.cpp.hpp:460)Any fix has to decide what the context-free overload does — silently stay uncorrected (so two APIs disagree), gain a parameter, or be deprecated.
2. Correction is per-controller, not global. So the fix must scale each controller's pixels by its own adjustment.
CLEDController::getAdjustmentData(brightness)returnsColorAdjustment.premixed— but as the name says, that premixes brightness, and brightness is already applied separately viascale_power_for_brightness(). Using it naively double-counts brightness.3. It changes power-limiting output for every existing user. Limits relax wherever correction attenuates a channel. That's correct — the estimate tracks real draw more closely — but power limiting is safety-adjacent, and a change that lets everyone's strips draw more current on upgrade deserves a maintainer's explicit sign-off rather than arriving in a triage sweep.
Two things on this thread that are separate from the core bug, recorded so they don't get lost:
getEstimatedPowerInMilliWatts()now covers the read-back need anyway.Deferred rather than closed: the bug is real and worth fixing, it just needs someone to pick an answer to the either/or first.