From c9e5773d6f65ddc67b2cbb594144d77914bc7e71 Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Wed, 12 May 2021 08:39:53 -0700 Subject: [PATCH 1/3] Add missing LED Matrix suspend code to suspend.c --- tmk_core/common/avr/suspend.c | 8 ++++++++ tmk_core/common/chibios/suspend.c | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index e9ee0aefdd39..81bbcf742936 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -167,6 +167,10 @@ void suspend_power_down(void) { rgb_matrix_set_suspend_state(true); # endif +# if defined(LED_MATRIX_ENABLE) + led_matrix_set_suspend_state(true); +# endif + // Enter sleep state if possible (ie, the MCU has a watchdog timeout interrupt) # if defined(WDT_vect) power_down(WDTO_15MS); @@ -222,6 +226,10 @@ void suspend_wakeup_init(void) { rgb_matrix_set_suspend_state(false); #endif +#if defined(LED_MATRIX_ENABLE) + led_matrix_set_suspend_state(false); +#endif + suspend_wakeup_init_kb(); } diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index 14a9aecb3156..62e944837846 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c @@ -86,6 +86,10 @@ void suspend_power_down(void) { #if defined(RGB_MATRIX_ENABLE) rgb_matrix_set_suspend_state(true); #endif +#if defined(LED_MATRIX_ENABLE) + led_matrix_set_suspend_state(true); +#endif + #ifdef AUDIO_ENABLE stop_all_notes(); #endif /* AUDIO_ENABLE */ @@ -156,6 +160,9 @@ void suspend_wakeup_init(void) { #endif #if defined(RGB_MATRIX_ENABLE) rgb_matrix_set_suspend_state(false); +#endif +#if defined(LED_MATRIX_ENABLE) + led_matrix_set_suspend_state(false); #endif suspend_wakeup_init_kb(); } From ac56c2d315a229eb2f8217ddc4e7cc079b07ce8a Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 12 May 2021 17:11:09 -0700 Subject: [PATCH 2/3] Swap order of RGB/LED functions to match Co-authored-by: Ryan --- tmk_core/common/avr/suspend.c | 15 +++++++-------- tmk_core/common/chibios/suspend.c | 13 ++++++------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index 81bbcf742936..9cc7b5743f18 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -163,14 +163,14 @@ void suspend_power_down(void) { rgblight_suspend(); # endif -# if defined(RGB_MATRIX_ENABLE) - rgb_matrix_set_suspend_state(true); -# endif - # if defined(LED_MATRIX_ENABLE) led_matrix_set_suspend_state(true); # endif +# if defined(RGB_MATRIX_ENABLE) + rgb_matrix_set_suspend_state(true); +# endif + // Enter sleep state if possible (ie, the MCU has a watchdog timeout interrupt) # if defined(WDT_vect) power_down(WDTO_15MS); @@ -222,13 +222,12 @@ void suspend_wakeup_init(void) { #if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) rgblight_wakeup(); #endif -#if defined(RGB_MATRIX_ENABLE) - rgb_matrix_set_suspend_state(false); -#endif - #if defined(LED_MATRIX_ENABLE) led_matrix_set_suspend_state(false); #endif +#if defined(RGB_MATRIX_ENABLE) + rgb_matrix_set_suspend_state(false); +#endif suspend_wakeup_init_kb(); } diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index 62e944837846..716c6fe6f667 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c @@ -83,13 +83,12 @@ void suspend_power_down(void) { #if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) rgblight_suspend(); #endif -#if defined(RGB_MATRIX_ENABLE) - rgb_matrix_set_suspend_state(true); -#endif #if defined(LED_MATRIX_ENABLE) led_matrix_set_suspend_state(true); #endif - +#if defined(RGB_MATRIX_ENABLE) + rgb_matrix_set_suspend_state(true); +#endif #ifdef AUDIO_ENABLE stop_all_notes(); #endif /* AUDIO_ENABLE */ @@ -158,11 +157,11 @@ void suspend_wakeup_init(void) { #if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) rgblight_wakeup(); #endif -#if defined(RGB_MATRIX_ENABLE) - rgb_matrix_set_suspend_state(false); -#endif #if defined(LED_MATRIX_ENABLE) led_matrix_set_suspend_state(false); +#endif +#if defined(RGB_MATRIX_ENABLE) + rgb_matrix_set_suspend_state(false); #endif suspend_wakeup_init_kb(); } From e8cec7a4a7198e0297004e9a205cbc6d2b5e4616 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 12 May 2021 18:17:55 -0700 Subject: [PATCH 3/3] More tweaks Co-authored-by: Ryan --- tmk_core/common/avr/suspend.c | 2 +- tmk_core/common/chibios/suspend.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index 9cc7b5743f18..690d7f38caa2 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -166,7 +166,6 @@ void suspend_power_down(void) { # if defined(LED_MATRIX_ENABLE) led_matrix_set_suspend_state(true); # endif - # if defined(RGB_MATRIX_ENABLE) rgb_matrix_set_suspend_state(true); # endif @@ -222,6 +221,7 @@ void suspend_wakeup_init(void) { #if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) rgblight_wakeup(); #endif + #if defined(LED_MATRIX_ENABLE) led_matrix_set_suspend_state(false); #endif diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index 716c6fe6f667..38517e06f0bf 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c @@ -83,6 +83,7 @@ void suspend_power_down(void) { #if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) rgblight_suspend(); #endif + #if defined(LED_MATRIX_ENABLE) led_matrix_set_suspend_state(true); #endif @@ -157,6 +158,7 @@ void suspend_wakeup_init(void) { #if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) rgblight_wakeup(); #endif + #if defined(LED_MATRIX_ENABLE) led_matrix_set_suspend_state(false); #endif