-
-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Avoid repeated calls to rgblight_set() in tight succession when setting lighting layers #18338
Conversation
c1fb57f
to
bcb20d1
Compare
d51020c
to
bcb20d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs some testing, but looks like it should work
Co-authored-by: Sergey Vlasov <[email protected]>
…ng lighting layers (qmk#18338) Co-authored-by: Sergey Vlasov <[email protected]>
…ng lighting layers (qmk#18338) Co-authored-by: Sergey Vlasov <[email protected]>
This PR broke RGBLIGHT for my setup. I do not know if this is a widespread problem, or just particular to my setup, but with both an ELITE-C and a FROOD (rp2040) boards, reverting this PR returns the RGB operation to a working state. Way it breaks, with this PR:
I tested it by checking out ae94be9, reverting this PR (patching my tree with git diff + patch -p1 < patch), recompiling the code and reflashing the board (both ELITE-C and rp2040 MCUs). |
PR qmk#18338 introduced a change that deferred rgblight_set after a call to rgblight_set_layer_state to the next invocation of rgblight_task. However, rgblight_task is a no-op unless RGBLIGHT_USE_TIMER is set, which only happens automatically if an RGB animation is enabled, or if RGBLIGHT_LAYER_BLINK is enabled. If neither of these are enabled, rgblight_set is never called automatically after rgblight_set_layer_state, so the LED state is never actually set. This commit fixes this issue by ensuring that RGBLIGHT_USER_TIMER is set if rgblight layers are enabled.
Description
See https://discord.com/channels/440868230475677696/440868230475677698/1018496514470981642.
There is a hypothesis that quickly repeated calls to
rgblight_set()
can cause problems with certain led drivers on certain boards / MCUs. That situation occurs when:layer_state_set_user()
to select lighting layers based on the currently enabled keymap layers, and...RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
is set and rgblight is currently disabled.Regardless of whether the repeated calls to
rgblight_set()
cause timing issues, it's much more efficient to avoid them. This PR eliminates the repeated calls torgblight_set()
by deferring the action until the next invocation ofrgblight_task()
.Types of Changes
Issues Fixed or Closed by This PR
Checklist