summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Arlott <70171+nomis@users.noreply.github.com>2022-04-21 17:33:29 +0100
committerGitHub <noreply@github.com>2022-04-21 09:33:29 -0700
commit1e389c7904e42df36d8a2f64b315b83f70aa9b60 (patch)
tree18bb819c5ceaccba41293efa97cdad4245b8feaf
parentfb4f25c0b57a9881f773cb2ac356bc84f06d488d (diff)
rgblight: Fix rgblight_blink_layer when multiple layers are active (#16824)
-rw-r--r--quantum/rgblight/rgblight.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c
index f4ddb81e92..3bacbda876 100644
--- a/quantum/rgblight/rgblight.c
+++ b/quantum/rgblight/rgblight.c
@@ -829,18 +829,19 @@ void rgblight_blink_layer_repeat(uint8_t layer, uint16_t duration_ms, uint8_t ti
829void rgblight_blink_layer_repeat_helper(void) { 829void rgblight_blink_layer_repeat_helper(void) {
830 if (_blinking_layer_mask != 0 && timer_expired(sync_timer_read(), _repeat_timer)) { 830 if (_blinking_layer_mask != 0 && timer_expired(sync_timer_read(), _repeat_timer)) {
831 for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) { 831 for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) {
832 if ((_blinking_layer_mask & (rgblight_layer_mask_t)1 << layer) != 0 && _times_remaining > 0) { 832 if ((_blinking_layer_mask & (rgblight_layer_mask_t)1 << layer) != 0) {
833 if (_times_remaining % 2 == 1) { 833 if (_times_remaining % 2 == 1) {
834 rgblight_set_layer_state(layer, false); 834 rgblight_set_layer_state(layer, false);
835 } else { 835 } else {
836 rgblight_set_layer_state(layer, true); 836 rgblight_set_layer_state(layer, true);
837 } 837 }
838 _times_remaining--;
839 _repeat_timer = sync_timer_read() + _dur;
840 } 838 }
841 } 839 }
840 _times_remaining--;
842 if (_times_remaining <= 0) { 841 if (_times_remaining <= 0) {
843 _blinking_layer_mask = 0; 842 _blinking_layer_mask = 0;
843 } else {
844 _repeat_timer = sync_timer_read() + _dur;
844 } 845 }
845 } 846 }
846} 847}