-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Perceptual brightness usermod #4346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This usermod adds API commands for changing the global brightness in steps that look even to the human eye, but in reality are small steps at the low end and large steps at the high end. There are commands included to put brightness controls on a single button, ramping the brightness while the button is held down.
|
thanks for contributing! |
|
Oh that's interesting. Yeah the 'gamma for brightness' is computing brightness basically the same way as this usermod. I'm struggling to recreate the button functionality I've got here without the usermod though. Is there a way to set lower/upper bound and step size in the API brightness command? Ideally I wouldn't want the gamma-adjusted brightness to go below 60 or above 160 on my setup. It seems with this gamma-adjusted brightness there are many low values which aren't really running. It could be that my usermod's useful bit is press-and-hold button handling for brightness, with max/min/step size and the brightness cycling variations. Or does that make sense as an API extension and not a usermod? |
|
I am not familiar enough with JSON commands to say if it is possible. The press end hold for brightness already exists, you just assign a preset to increase or decrease brightness with a defined step size and assign that to "long press" of the button (which still may have a bug, as discussed on discord). So the only thing missing would be to set upper and lower limits, correct? |
|
|
|
Hmm, I tried exactly that API command in a preset and it doesn't work, from 0_15 branch. It works for you @blazoncek? |
|
Looks like it is not working for "bri". You can file a bug report. |
|
Similar to #3605 |
|
I have a generic fix. The API is |
|
OK so the API call would be different. There is still a bug though, correct? The different API command only sets the brightness to 60 for me. I'm not even certain it's a bug as I don't see that brightness behavior documented, and I don't see where that code would be from searching the source. At any rate it would be nice to have that in the API. |
- allow incrementing/decrementing as specified in API
|
I just applied your 52e08d2 commit and tried it out with and without wrapping for brightness. Works perfectly! Between that and the gamma correction for brightness feature, my usermod isn't adding much 😁 Will close the pull request. Thanks! |
- allow incrementing/decrementing as specified in API
- allow incrementing/decrementing as specified in API
This usermod lets you make changes to WLED global brightness in 'steps' that are evenly spaced to the human eye.
It lets the user define how many brightness steps to use (up to 32 by default) and what the maximum brightness should be. It also allows for skipping steps at the beginning and end of the range.
The usermod provides JSON API commands to step up and down in brightness,
{"pb":"+"}and{"pb":"-"}respectively. It also provides commands to cycle brightness on a button hold, changing directions after a brief button release or optionally changing directions after reaching an extreme without a button release,{"pb":"/"}and{"pb":"~"}respectively.