-
-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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 zero condition of reactive runners that will suspend RGB animation #12710
Conversation
I don't really agree that this should be the behavior. Note that it isn't overflowing; the ticks are just being multiplied by zero. For effects that light up the keyboard at the instantaneous moment of a keypress, this will indeed result in lighting up the entire keyboard. That is, at speed=0, only the zeroth frame of the reactive animation will play (a little more complicated for mutikey effects, but essentially the same), and this persists for around 65 s or max keypresses remembered is reached. If this is not the behavior of an animation, the animation is what should be fixed. |
I do see your point, but I don't believe that's the spirit of the reactive light intention. That said, @XScorpion2 is the original coder—will let him/her comment if "zero" RGB reactive speed is meant to light up the entire board. |
I think that with respect to spirit, documentation on the speed variable might also serve well: mention that speed 0 means the animation will literally freeze at the zeroth frame, 1 is the slowest speed, and 255 is fastest. If this PR is accepted, there should also be a comment on why 1 is added to the divisor in this particular runner and not the other runners. Note that "lighting up the board" is a consequence of this particular runner: for instance, for |
So, this may sound like a stupid reason as to why I allowed 0: So your value changes would look something like: Instead of today where it looks like this: (Most of my boards I've configured to use 4 or 8 for the step values, and in some cases even 1, additionally I use OLEDs that display the raw values for each of the rgb settings on screen) As far as this change goes, since this modifies the time value at the effect level, this prevents the value shifting issue mentioned above, but then you end up in an arguably just as an odd state that when you hit 0 speed, the animation is still in fact running. Ultimately I see neither solution being right or wrong, just which one QMK wants as a whole. So either or change works just fine for me, no real opinion on what the correct behavior is |
Thanks for the input. In this case, setting the minimum value at |
@XScorpion2 I did a quick console test to verify the values of They don't seem to align at powers of 2 when decrementing from max 255. |
I may be off on my memory, but that was the original intent at any rate when I implemented it. Ah well, not really all that important as it's more about what people would prefer either way. |
I think I now agree with @filterpaper to add one, and it should be implemented on all the runners. Animation writers that want the weird behavior at speed=0 should just subtract 1 themselves. |
Thank you for your contribution! |
I don't think it really matters, everything else will be relatively consistent. |
#12710) * Avoid zero or overflow from user's rgb_matrix_config.speed * Avoid zero tick for reactive splash. * Avoid zero time for animation runner. Co-authored-by: filterpaper <filterpaper@localhost>
qmk#12710) * Avoid zero or overflow from user's rgb_matrix_config.speed * Avoid zero tick for reactive splash. * Avoid zero time for animation runner. Co-authored-by: filterpaper <filterpaper@localhost>
qmk#12710) * Avoid zero or overflow from user's rgb_matrix_config.speed * Avoid zero tick for reactive splash. * Avoid zero time for animation runner. Co-authored-by: filterpaper <filterpaper@localhost>
qmk#12710) * Avoid zero or overflow from user's rgb_matrix_config.speed * Avoid zero tick for reactive splash. * Avoid zero time for animation runner. Co-authored-by: filterpaper <filterpaper@localhost>
qmk#12710) * Avoid zero or overflow from user's rgb_matrix_config.speed * Avoid zero tick for reactive splash. * Avoid zero time for animation runner. Co-authored-by: filterpaper <filterpaper@localhost>
qmk#12710) * Avoid zero or overflow from user's rgb_matrix_config.speed * Avoid zero tick for reactive splash. * Avoid zero time for animation runner. Co-authored-by: filterpaper <filterpaper@localhost>
qmk#12710) * Avoid zero or overflow from user's rgb_matrix_config.speed * Avoid zero tick for reactive splash. * Avoid zero time for animation runner. Co-authored-by: filterpaper <filterpaper@localhost>
Description
If user keyboard's RGB speed setting (
rgb_matrix_config.speed
) is at zero, key press animation will remain static. Reactive runners will keep one key or entire keyboard lit.This change avoid both conditions with a minimum value to the
tick
variable.Types of Changes
Checklist