Skip to content

st3m: leds: Scale the slew rate for each channel separately

Phileas requested to merge slew into main

The reason why this is needed is pretty easy to observe when taking a color like (1.0, 0.75, 0.0), which appears yellow, and transitioning it to (0.0, 0.0, 0.0). Without this, all the channel values get reduced at constant rate, meaning that the green channel will reach zero much earlier than the red one, so in the middle of transition the yellow color will turn into red.

To prevent that and preserve the hue, desaturate only the channel with the greatest difference from target at full rate and scale the rest in relation to that one. This way the transition still takes the exact same time, but doesn't go through unexpected color hues during it.

Merge request reports

Loading