diff options
author | Drashna Jaelre <drashna@live.com> | 2021-08-20 06:14:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-20 06:14:42 -0700 |
commit | 92fa07336cd7fcd578c31a8069cf955a4d601327 (patch) | |
tree | cb98f0bcbf2de674340f7063b5a5b242f6bdca3b | |
parent | da11a49905605871eea66f8f03b2c4b46d1de88a (diff) | |
download | qmk_firmware-92fa07336cd7fcd578c31a8069cf955a4d601327.tar.gz qmk_firmware-92fa07336cd7fcd578c31a8069cf955a4d601327.zip |
[Bug] Fix RGB/LED Matrix Suspend code (#14084)
-rw-r--r-- | quantum/led_matrix/led_matrix.c | 5 | ||||
-rw-r--r-- | quantum/rgb_matrix/rgb_matrix.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c index bcf258b26..913384913 100644 --- a/quantum/led_matrix/led_matrix.c +++ b/quantum/led_matrix/led_matrix.c | |||
@@ -459,8 +459,9 @@ void led_matrix_init(void) { | |||
459 | 459 | ||
460 | void led_matrix_set_suspend_state(bool state) { | 460 | void led_matrix_set_suspend_state(bool state) { |
461 | #ifdef LED_DISABLE_WHEN_USB_SUSPENDED | 461 | #ifdef LED_DISABLE_WHEN_USB_SUSPENDED |
462 | if (state && is_keyboard_master()) { | 462 | if (state && !suspend_state && is_keyboard_master()) { // only run if turning off, and only once |
463 | led_matrix_set_value_all(0); // turn off all LEDs when suspending | 463 | led_task_effect(0); // turn off all LEDs when suspending |
464 | led_task_flush(0); // and actually flash led state to LEDs | ||
464 | } | 465 | } |
465 | suspend_state = state; | 466 | suspend_state = state; |
466 | #endif | 467 | #endif |
diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c index e5635ee03..8f00b4087 100644 --- a/quantum/rgb_matrix/rgb_matrix.c +++ b/quantum/rgb_matrix/rgb_matrix.c | |||
@@ -501,8 +501,9 @@ void rgb_matrix_init(void) { | |||
501 | 501 | ||
502 | void rgb_matrix_set_suspend_state(bool state) { | 502 | void rgb_matrix_set_suspend_state(bool state) { |
503 | #ifdef RGB_DISABLE_WHEN_USB_SUSPENDED | 503 | #ifdef RGB_DISABLE_WHEN_USB_SUSPENDED |
504 | if (state) { | 504 | if (state && !suspend_state) { // only run if turning off, and only once |
505 | rgb_matrix_set_color_all(0, 0, 0); // turn off all LEDs when suspending | 505 | rgb_task_render(0); // turn off all LEDs when suspending |
506 | rgb_task_flush(0); // and actually flash led state to LEDs | ||
506 | } | 507 | } |
507 | suspend_state = state; | 508 | suspend_state = state; |
508 | #endif | 509 | #endif |