Add light_context_mode enum and '-e' option for the exponential light changing.
Selection of raw, percentage or exponential mode now done using enum light_context_mode and field ctx->run_params.mode. Argument '-e' enables exponential mode which will change brightness in natural way for some displays, using logarithmic scale with base 4.
Very cool, thanks a ton for taking the time to improve this project! It's in need of love.
I dont have too much time to review this PR right now, but one point I noticed; I think the exponent should be a runtime-configurable parameter. I dont think it should be hardcoded. Maybe with a default value of 4, but still configurable in runtime by passing a float after the -e flag. So for example; light -A 10 -e 2.8 would use 2.8 as the exponent.
Backlight controllers are very different in their behaviour, so even if 4 works well for your controller, its not guaranteed to work well for other controllers that seem to work exponentially. Some have a built-in minimum cap, some just go pitch black at 0 for example. We cant make any assumptions about the controllers.
Again, big thanks for showing this project love! I will keep this open for a while to let people test it out and verify it works, but feel free to improve upon it if you feel like it! Cheers
Thank you for the reply! I've made an optional argument to specify exponential base and more adequate behavior on small brightness values.