summary refs log tree commit diff
path: root/quantum
diff options
context:
space:
mode:
authorJoshua Diamond <josh@windowoffire.com>2020-06-01 05:02:28 -0400
committerGitHub <noreply@github.com>2020-06-01 11:02:28 +0200
commite2e287ec5f720839efd8f7cecf447763433cda27 (patch)
treefba21d51c2a44c3c088872ce940c2d0e48b3fa45 /quantum
parentdfcd4f0d25bb3db8798ad8bb06da0fab68e7cf25 (diff)
Option to allow lighting layers when RGB Lighting is off (#9051)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/rgblight.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index 73a7afd7b3..949dd79fe7 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -628,6 +628,13 @@ void rgblight_set_layer_state(uint8_t layer, bool enabled) {
     if (rgblight_status.timer_enabled == false) {
         rgblight_mode_noeeprom(rgblight_config.mode);
     }
+
+#    ifdef RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
+    // If not enabled, then nothing else will actually set the LEDs...
+    if (!rgblight_config.enable) {
+        rgblight_set();
+    }
+#    endif
 }
 
 bool rgblight_get_layer_state(uint8_t layer) {
@@ -693,16 +700,11 @@ void rgblight_unblink_layers(void) {
 __attribute__((weak)) void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { ws2812_setleds(start_led, num_leds); }
 
 #ifndef RGBLIGHT_CUSTOM_DRIVER
+
 void rgblight_set(void) {
     LED_TYPE *start_led;
     uint8_t   num_leds = rgblight_ranges.clipping_num_leds;
 
-#    ifdef RGBLIGHT_LAYERS
-    if (rgblight_layers != NULL) {
-        rgblight_layers_write();
-    }
-#    endif
-
     if (!rgblight_config.enable) {
         for (uint8_t i = rgblight_ranges.effect_start_pos; i < rgblight_ranges.effect_end_pos; i++) {
             led[i].r = 0;
@@ -714,6 +716,16 @@ void rgblight_set(void) {
         }
     }
 
+#    ifdef RGBLIGHT_LAYERS
+    if (rgblight_layers != NULL
+#        ifndef RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
+        && rgblight_config.enable
+#        endif
+    ) {
+        rgblight_layers_write();
+    }
+#    endif
+
 #    ifdef RGBLIGHT_LED_MAP
     LED_TYPE led0[RGBLED_NUM];
     for (uint8_t i = 0; i < RGBLED_NUM; i++) {