From 77092675aa7ec001e6466f5ab099dcc9fbcfc856 Mon Sep 17 00:00:00 2001 From: Albert Y <76888457+filterpaper@users.noreply.github.com> Date: Fri, 30 Dec 2022 08:38:15 +0800 Subject: [PATCH] Update RGB matrix reactive gradient timer scale (#19415) --- quantum/rgb_matrix/animations/solid_reactive_anim.h | 2 +- quantum/rgb_matrix/animations/solid_reactive_cross.h | 2 +- quantum/rgb_matrix/animations/solid_reactive_nexus.h | 5 +++-- quantum/rgb_matrix/animations/solid_reactive_simple_anim.h | 2 +- quantum/rgb_matrix/animations/solid_reactive_wide.h | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/quantum/rgb_matrix/animations/solid_reactive_anim.h b/quantum/rgb_matrix/animations/solid_reactive_anim.h index 052bfb22fd4a..edf604135031 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_anim.h +++ b/quantum/rgb_matrix/animations/solid_reactive_anim.h @@ -5,7 +5,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE) static HSV SOLID_REACTIVE_math(HSV hsv, uint16_t offset) { # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE - hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6); + hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); # endif hsv.h += qsub8(130, offset); return hsv; diff --git a/quantum/rgb_matrix/animations/solid_reactive_cross.h b/quantum/rgb_matrix/animations/solid_reactive_cross.h index 9e5703a0ea38..a18d6b03dd6b 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_cross.h +++ b/quantum/rgb_matrix/animations/solid_reactive_cross.h @@ -20,7 +20,7 @@ static HSV SOLID_REACTIVE_CROSS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t di effect += dx > dy ? dy : dx; if (effect > 255) effect = 255; # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE - hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6); + hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); # endif hsv.v = qadd8(hsv.v, 255 - effect); return hsv; diff --git a/quantum/rgb_matrix/animations/solid_reactive_nexus.h b/quantum/rgb_matrix/animations/solid_reactive_nexus.h index 64f5064cf98e..53cc008616de 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_nexus.h +++ b/quantum/rgb_matrix/animations/solid_reactive_nexus.h @@ -17,10 +17,11 @@ static HSV SOLID_REACTIVE_NEXUS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t di if (dist > 72) effect = 255; if ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) effect = 255; # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE - hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6); + hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4) + dy / 4; +# else + hsv.h = rgb_matrix_config.hsv.h + dy / 4; # endif hsv.v = qadd8(hsv.v, 255 - effect); - hsv.h = rgb_matrix_config.hsv.h + dy / 4; return hsv; } diff --git a/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h b/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h index bd3ce0817d2b..7f4e48747a6c 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h +++ b/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h @@ -5,7 +5,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE) static HSV SOLID_REACTIVE_SIMPLE_math(HSV hsv, uint16_t offset) { # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE - hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6); + hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); # endif hsv.v = scale8(255 - offset, hsv.v); return hsv; diff --git a/quantum/rgb_matrix/animations/solid_reactive_wide.h b/quantum/rgb_matrix/animations/solid_reactive_wide.h index 24fedc202072..feca1266483d 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_wide.h +++ b/quantum/rgb_matrix/animations/solid_reactive_wide.h @@ -15,7 +15,7 @@ static HSV SOLID_REACTIVE_WIDE_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dis uint16_t effect = tick + dist * 5; if (effect > 255) effect = 255; # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE - hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6); + hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); # endif hsv.v = qadd8(hsv.v, 255 - effect); return hsv;