aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Tackitt <franklyn@tackitt.net>2018-11-07 09:25:18 -0700
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2018-11-07 08:25:18 -0800
commit94f58322ac3dde1a4694733c51a44c4d24ec3fc0 (patch)
tree1095c69452358a88d05165eb5386e41a7bed3734
parenta30dd2bb1711f5402007adf89af9b3adb758a7fb (diff)
downloadqmk_firmware-94f58322ac3dde1a4694733c51a44c4d24ec3fc0.tar.gz
qmk_firmware-94f58322ac3dde1a4694733c51a44c4d24ec3fc0.zip
Configurable Rainbow Swirl range (#4376)
* Configurable Rainbow Swirl range This allows tweaking of the rainbow effect to get different effects on keyboards with varied LED layouts. We found the value 1950 works on the RGBKB.net Sol to get a cool striped effect across the keyboard. * Document RGBLIGHT_RAINBOW_SWIRL_RANGE * Better wording for the documentation
-rw-r--r--docs/feature_rgblight.md1
-rw-r--r--quantum/rgblight.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md
index a2820347d..0205ebe91 100644
--- a/docs/feature_rgblight.md
+++ b/docs/feature_rgblight.md
@@ -122,6 +122,7 @@ The following options can be used to tweak the various animations:
122|`RGBLIGHT_EFFECT_KNIGHT_LED_NUM` |`RGBLED_NUM` |The number of LEDs to have the "Knight" animation travel | 122|`RGBLIGHT_EFFECT_KNIGHT_LED_NUM` |`RGBLED_NUM` |The number of LEDs to have the "Knight" animation travel |
123|`RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL`|`1000` |How long to wait between light changes for the "Christmas" animation, in milliseconds| 123|`RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL`|`1000` |How long to wait between light changes for the "Christmas" animation, in milliseconds|
124|`RGBLIGHT_EFFECT_CHRISTMAS_STEP` |`2` |The number of LEDs to group the red/green colors by for the "Christmas" animation | 124|`RGBLIGHT_EFFECT_CHRISTMAS_STEP` |`2` |The number of LEDs to group the red/green colors by for the "Christmas" animation |
125|`RGBLIGHT_RAINBOW_SWIRL_RANGE` |`360` |Range adjustment for the rainbow swirl effect to get different swirls |
125 126
126You can also modify the speeds that the different modes animate at: 127You can also modify the speeds that the different modes animate at:
127 128
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index 94e9c0a3b..9ce3b2309 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -679,6 +679,10 @@ void rgblight_effect_rainbow_mood(uint8_t interval) {
679#endif 679#endif
680 680
681#ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL 681#ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL
682#ifndef RGBLIGHT_RAINBOW_SWIRL_RANGE
683 #define RGBLIGHT_RAINBOW_SWIRL_RANGE 360
684#endif
685
682__attribute__ ((weak)) 686__attribute__ ((weak))
683const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20}; 687const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20};
684 688
@@ -692,7 +696,7 @@ void rgblight_effect_rainbow_swirl(uint8_t interval) {
692 } 696 }
693 last_timer = timer_read(); 697 last_timer = timer_read();
694 for (i = 0; i < RGBLED_NUM; i++) { 698 for (i = 0; i < RGBLED_NUM; i++) {
695 hue = (360 / RGBLED_NUM * i + current_hue) % 360; 699 hue = (RGBLIGHT_RAINBOW_SWIRL_RANGE / RGBLED_NUM * i + current_hue) % 360;
696 sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]); 700 sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);
697 } 701 }
698 rgblight_set(); 702 rgblight_set();