summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorMichaƂ Szczepaniak <m.szczepaniak.000@gmail.com>2022-04-18 11:07:36 +0200
committerGitHub <noreply@github.com>2022-04-18 02:07:36 -0700
commit5b6faa173bef50f7aef146393a2033ed5101c842 (patch)
treead51acb44b012aebcfc8a8db20d00ae34fddc52e /quantum
parent4d67fe66a3c928df170c51de8bb65d3136dd1a11 (diff)
Add customizable snake and knight animation increments (#16337)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/rgblight/rgblight.c8
-rw-r--r--quantum/rgblight/rgblight.h8
2 files changed, 12 insertions, 4 deletions
diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c
index 1f8b68ee59..dc5757cb00 100644
--- a/quantum/rgblight/rgblight.c
+++ b/quantum/rgblight/rgblight.c
@@ -1273,19 +1273,19 @@ void rgblight_effect_snake(animation_status_t *anim) {
}
rgblight_set();
if (increment == 1) {
- if (pos - 1 < 0) {
+ if (pos - RGBLIGHT_EFFECT_SNAKE_INCREMENT < 0) {
pos = rgblight_ranges.effect_num_leds - 1;
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
anim->pos = 0;
# endif
} else {
- pos -= 1;
+ pos -= RGBLIGHT_EFFECT_SNAKE_INCREMENT;
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
anim->pos = 1;
# endif
}
} else {
- pos = (pos + 1) % rgblight_ranges.effect_num_leds;
+ pos = (pos + RGBLIGHT_EFFECT_SNAKE_INCREMENT) % rgblight_ranges.effect_num_leds;
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
anim->pos = pos;
# endif
@@ -1299,7 +1299,7 @@ __attribute__((weak)) const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63
void rgblight_effect_knight(animation_status_t *anim) {
static int8_t low_bound = 0;
static int8_t high_bound = RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1;
- static int8_t increment = 1;
+ static int8_t increment = RGBLIGHT_EFFECT_KNIGHT_INCREMENT;
uint8_t i, cur;
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
diff --git a/quantum/rgblight/rgblight.h b/quantum/rgblight/rgblight.h
index 189c4d18b8..a08b9a7b6b 100644
--- a/quantum/rgblight/rgblight.h
+++ b/quantum/rgblight/rgblight.h
@@ -126,10 +126,18 @@ enum RGBLIGHT_EFFECT_MODE {
# define RGBLIGHT_EFFECT_SNAKE_LENGTH 4
#endif
+#ifndef RGBLIGHT_EFFECT_SNAKE_INCREMENT
+# define RGBLIGHT_EFFECT_SNAKE_INCREMENT 1
+#endif
+
#ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH
# define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3
#endif
+#ifndef RGBLIGHT_EFFECT_KNIGHT_INCREMENT
+# define RGBLIGHT_EFFECT_KNIGHT_INCREMENT 1
+#endif
+
#ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET
# define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0
#endif