Skip to content
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

Fix setting brightness to max value and brightness fading loop condition #35

Merged
merged 5 commits into from
Jul 14, 2021

Conversation

Martin-HiPi
Copy link
Contributor

  • Function _denormalize_brightness does not clamp the output to the normal 0-255 int() range. Force-clamped 0-255 now.
  • Function _normalize_brightness does not clamp the output to the normal 0-100 percent range. Force-clamped 0-100 now.
  • In @brightness.setter, the while loop looks only for current_value != value. In some circumstances, it won't stop incrementing. Hard-clamped to 0-100 percent range.

- Function _denormalize_brightness does not clamp the output to the normal 0-255 int() range. Force-clamped 0-255 now.
- Function _normalize_brightness does not clamp the output to the normal 0-100 percent range. Force-clamped 0-100 now.
- In @brightness.setter, the while loop looks only for current_value != value. In some circumstances, it won't stop incrementing.  Hard-clamped to 0-100 percent range.
Copy link
Owner

@linusg linusg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but neither debug printing nor commented code should be included. Also failing the black formatting check.

@Martin-HiPi
Copy link
Contributor Author

Thanks @linusg for taking the time to review the PR.

I'm not too familiar with the black formatting part, anything you can point me to?
Thanks!

@linusg
Copy link
Owner

linusg commented Jul 14, 2021

I used what showed in the logs to re-write the while conditions.
@Martin-HiPi
Copy link
Contributor Author

@linusg Thanks for the info!

Fixed one missing space in def _normalize_brightness that caused the black formatting check to fail.
Two lines had spaces at the end. These are obviously invisible in black logs unless you actively search for them!
@linusg linusg changed the title Fix writing val > 255 and fix brightness function while loop Fix setting brightness to max value and brightness fading loop condition Jul 14, 2021
@linusg linusg merged commit cf0170a into linusg:main Jul 14, 2021
@linusg
Copy link
Owner

linusg commented Jul 14, 2021

Thanks for the fixes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants