]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - tmk_core/common/avr/suspend.c
fixed matrix (#5831)
[qmk_firmware.git] / tmk_core / common / avr / suspend.c
index 28219f4ddd7b900d356e15c7062b070141639919..2259201b5d99cf37c6b9bf7630c731b3606cd40c 100644 (file)
@@ -11,9 +11,6 @@
 #include "led.h"
 #include "host.h"
 #include "rgblight_reconfig.h"
-#ifdef SPLIT_KEYBOARD
-  #include "split_flags.h"
-#endif
 
 #ifdef PROTOCOL_LUFA
        #include "lufa.h"
@@ -102,24 +99,31 @@ static uint8_t wdt_timeout = 0;
  */
 static void power_down(uint8_t wdto) {
 #ifdef PROTOCOL_LUFA
-    if (USB_DeviceState == DEVICE_STATE_Configured) return;
+  if (USB_DeviceState == DEVICE_STATE_Configured) return;
 #endif
-    wdt_timeout = wdto;
+  wdt_timeout = wdto;
 
-    // Watchdog Interrupt Mode
-    wdt_intr_enable(wdto);
+  // Watchdog Interrupt Mode
+  wdt_intr_enable(wdto);
 
 #ifdef BACKLIGHT_ENABLE
-       backlight_set(0);
+  backlight_set(0);
 #endif
 
-       // Turn off LED indicators
-       led_set(0);
+  // 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);
 
-       #ifdef AUDIO_ENABLE
-        // This sometimes disables the start-up noise, so it's been disabled
-               // stop_all_notes();
-       #endif /* AUDIO_ENABLE */
+#ifdef AUDIO_ENABLE
+  // This sometimes disables the start-up noise, so it's been disabled
+  // stop_all_notes();
+#endif /* AUDIO_ENABLE */
 #if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
 #ifdef RGBLIGHT_ANIMATIONS
   rgblight_timer_disable();
@@ -128,9 +132,6 @@ static void power_down(uint8_t wdto) {
     is_suspended = true;
     rgblight_enabled = rgblight_config.enable;
     rgblight_disable_noeeprom();
-    #ifdef SPLIT_KEYBOARD
-        RGB_DIRTY = true;
-    #endif
   }
 #endif
   suspend_power_down_kb();
@@ -209,9 +210,6 @@ void suspend_wakeup_init(void) {
       wait_ms(10);
     #endif
     rgblight_enable_noeeprom();
-    #ifdef SPLIT_KEYBOARD
-        RGB_DIRTY = true;
-    #endif
   }
 #ifdef RGBLIGHT_ANIMATIONS
   rgblight_timer_enable();