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 morphing in 'blinkstick.py'. #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

elnarte
Copy link

@elnarte elnarte commented Jan 17, 2024

The current morphing implementation contains a dirty hack of descaling (including resetting the R,G,B values when they become larger than 255) because the method _determine_rgb() is called twice, once from morph() and a second time from set_color(). To prevent descaling, a part of the method set_color() has been separated into a private method _set_rgb() which is called both from set_color() and morph(). This also means that the functions _remap_rgb_value_reverse() and _remap_color_reverse() become obsolete. Additionally, applying color inversion has been moved to method _determine_rgb() just before applying max_rgb_value. This assures that first the proper R,G,B values are determined (inverted or not) and afterwards the proper brightness is determined. With this implementation, the morphing starts nicely at the current R,G,B values and gradually transitions towards the end R,G,B values.

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