Improving the FloatOutput class for LED brightness control

So I have 12V LED lightbulbs of different brands and models, connected to PWM outputs through mosfets (ESP32 so it uses the ledc platform, whose C++ class LEDCOutput inherits from FloatOutput).

The brightness is non-linearly related to the PWM duty cycle. Up to some value there’s no light coming out, from there the brightness increases at some rate and starting from say 85% duty cycle to 100% the brightness is again constant. With some models there’s even a slight peak around 80-90% after which the brightness goes down just very slightly to settle at the nominal brightness.

So I’d like to comensate for this and FloatOutput has min_power and max_power settings for this. But I’d like the pwm pins to output constant 0V level (0%) before min_power and constant logical 1 level (100%) after reaching max_power, to avoid wearing out the mosfets and the lightbulbs. I only need PWM for the short fade in and fade out effects.

So I can implement that locally but I’d like it to be user selectable through some output setting so that it’s potentially upstreamable. Does anyone have suggestions on what setting logic to use? Just add a new boolean settings off_at_min_power / on_at_max_power? Or maybe a full input interval to output interval mapping like the sensor output filter calibrate_linear?

Or, why not, a full fledged input filter setting that allows any of the existing filters, like calibrate_linear, delta, etc. to be applied to the input value?

Or should this be a light setting, like gamma? But you could argue it’s also useful for fan speeds etc. Thanks for reading until here :wink:

Hi there
I’ve found the same problem with dimming my strip LEDs with QuinLED-Deca boards
It seams not quite linearly or even over shoots and dims back slightly.
I always thought it was some thing to do with the mosfet on the board.
Did you ever find a fix for this.
Thanks