From a88eeb695c668413d6dd36cf6966157a8f719436 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Fri, 21 Aug 2020 11:26:06 +1000 Subject: [PATCH 1/2] Fix ChibiOS backlight not turning off on suspend --- tmk_core/common/chibios/suspend.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index 8c071e7a086d..11c8c378b723 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c @@ -47,6 +47,10 @@ __attribute__((weak)) void suspend_power_down_kb(void) { suspend_power_down_user * FIXME: needs doc */ void suspend_power_down(void) { +#ifdef BACKLIGHT_ENABLE + backlight_set(0); +#endif + // TODO: figure out what to power down and how // shouldn't power down TPM/FTM if we want a breathing LED // also shouldn't power down USB From fc62ab6c13439506fa50cf7f1b2d851887d3d9f6 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Wed, 26 Aug 2020 20:23:46 +1000 Subject: [PATCH 2/2] Add missing code for backlight as caps lock too --- tmk_core/common/chibios/suspend.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index 11c8c378b723..64dfc05abce2 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c @@ -9,6 +9,7 @@ #include "mousekey.h" #include "host.h" #include "suspend.h" +#include "led.h" #include "wait.h" #ifdef BACKLIGHT_ENABLE @@ -51,6 +52,16 @@ void suspend_power_down(void) { backlight_set(0); #endif + // Turn off LED indicators + uint8_t leds_off = 0; +#if defined(BACKLIGHT_CAPS_LOCK) && defined(BACKLIGHT_ENABLE) + if (is_backlight_enabled()) { + // Don't try to turn off Caps Lock indicator as it is backlight and backlight is already off + leds_off |= (1 << USB_LED_CAPS_LOCK); + } +#endif + led_set(leds_off); + // TODO: figure out what to power down and how // shouldn't power down TPM/FTM if we want a breathing LED // also shouldn't power down USB @@ -123,6 +134,7 @@ void suspend_wakeup_init(void) { #ifdef BACKLIGHT_ENABLE backlight_init(); #endif /* BACKLIGHT_ENABLE */ + led_set(host_keyboard_leds()); #if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) is_suspended = false; if (rgblight_enabled) {