Skip to content

Fix writing val > 255 and fix brightness function while loop - #1

Open
Martin-HiPi wants to merge 5 commits into
mainfrom
Martin-HiPi-patch-Clamp1
Open

Fix writing val > 255 and fix brightness function while loop#1
Martin-HiPi wants to merge 5 commits into
mainfrom
Martin-HiPi-patch-Clamp1

Conversation

@Martin-HiPi

Copy link
Copy Markdown
Owner
  • 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. Now while loop is hard-clamped to 0-100 percent range and becomes False if current_value exceeds limits.

- 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.
I used what showed in the logs to re-write the while conditions.
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!
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.

1 participant