FedeDP / Clightd

A linux bus interface that lets you change screen brightness, compute captured webcam frames brightness and change screen temperature.
GNU General Public License v3.0
82 stars 10 forks source link

[FEATURE REQ] Logarithmic sensor values #70

Closed abredall closed 3 years ago

abredall commented 3 years ago

Current sensor settings allow for defining of maximum and minimum values, i.e. ambient brightness = min(read_value / maximum, 1).

However, the human eye sees logarithmically, so perhaps it would be better to use min( log10(read_value) / log10(maximum), 1 ), or add an option to use logarithmic vs linear. (A special handling for potential negative values might be needed)

For example, the ALS on my laptop outputs lux values that can vary from 12,000 to 30,000 just by me swiveling my chair with my laptop on my lap. Current implementation results in a huge change of brightness due to the absolute difference, despite the ambient lighting in the room not actually changing all that much.

A logarithmic value would be more robust to these differences and behave more how a user might expect based on the perceived brightness of a room.

FedeDP commented 3 years ago

Hi! Thanks for opening this feature request, i think it makes indeed huge sense! As the change is rather small, are you willing to send a PR by chance? Anyway, i will move this issue to Clightd repository ;)

EDIT: you can see current "stupid" algorithm here: https://github.com/FedeDP/Clightd/blob/master/src/modules/sensors/als.c#L140

FedeDP commented 3 years ago

Closed by #71 ! Thank you!