]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Configurable Rainbow Swirl range (#4376)
authorFrank Tackitt <franklyn@tackitt.net>
Wed, 7 Nov 2018 16:25:18 +0000 (09:25 -0700)
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>
Wed, 7 Nov 2018 16:25:18 +0000 (08:25 -0800)
* 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

docs/feature_rgblight.md
quantum/rgblight.c

index a2820347deb7c251f91ff77e0de73ad2aeeeaeae..0205ebe91a7ca7c5e7f8aa7ced0cd88c4a081e78 100644 (file)
@@ -122,6 +122,7 @@ The following options can be used to tweak the various animations:
 |`RGBLIGHT_EFFECT_KNIGHT_LED_NUM`    |`RGBLED_NUM` |The number of LEDs to have the "Knight" animation travel                             |
 |`RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL`|`1000`       |How long to wait between light changes for the "Christmas" animation, in milliseconds|
 |`RGBLIGHT_EFFECT_CHRISTMAS_STEP`    |`2`          |The number of LEDs to group the red/green colors by for the "Christmas" animation    |
+|`RGBLIGHT_RAINBOW_SWIRL_RANGE`      |`360`        |Range adjustment for the rainbow swirl effect to get different swirls                |
 
 You can also modify the speeds that the different modes animate at:
 
index 94e9c0a3b2010394eed9d6c00acb4f8548449811..9ce3b2309253db8ba5f9717a8bdc4e882fdfffe6 100644 (file)
@@ -679,6 +679,10 @@ void rgblight_effect_rainbow_mood(uint8_t interval) {
 #endif
 
 #ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL
+#ifndef RGBLIGHT_RAINBOW_SWIRL_RANGE
+  #define RGBLIGHT_RAINBOW_SWIRL_RANGE 360
+#endif
+
 __attribute__ ((weak))
 const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20};
 
@@ -692,7 +696,7 @@ void rgblight_effect_rainbow_swirl(uint8_t interval) {
   }
   last_timer = timer_read();
   for (i = 0; i < RGBLED_NUM; i++) {
-    hue = (360 / RGBLED_NUM * i + current_hue) % 360;
+    hue = (RGBLIGHT_RAINBOW_SWIRL_RANGE / RGBLED_NUM * i + current_hue) % 360;
     sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);
   }
   rgblight_set();