diff options
| author | フィルターペーパー <76888457+filterpaper@users.noreply.github.com> | 2025-07-13 23:38:32 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-13 16:38:32 +0100 |
| commit | ad4233d07849ad96096fb84d01b0ed3200030b09 (patch) | |
| tree | bf7cbf80c1ae918fcee955fcec46f8f019cd6c3a | |
| parent | 2c34b480fc2c560e9905052ec26a7f4cb1ff856c (diff) | |
Clamp reactive offset value (#25489)
* Avoids underflow of the unsigned 8-bit
| -rw-r--r-- | quantum/rgb_matrix/animations/solid_reactive_anim.h | 1 | ||||
| -rw-r--r-- | quantum/rgb_matrix/animations/solid_reactive_simple_anim.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/quantum/rgb_matrix/animations/solid_reactive_anim.h b/quantum/rgb_matrix/animations/solid_reactive_anim.h index 67f568ca38..d11dda50c3 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_anim.h +++ b/quantum/rgb_matrix/animations/solid_reactive_anim.h | |||
| @@ -4,6 +4,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE) | |||
| 4 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 4 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 5 | 5 | ||
| 6 | static hsv_t SOLID_REACTIVE_math(hsv_t hsv, uint16_t offset) { | 6 | static hsv_t SOLID_REACTIVE_math(hsv_t hsv, uint16_t offset) { |
| 7 | if (offset > 255) offset = 255; | ||
| 7 | # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE | 8 | # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE |
| 8 | hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); | 9 | hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); |
| 9 | # endif | 10 | # endif |
diff --git a/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h b/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h index f20f1b1fb6..22ba42296f 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h +++ b/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h | |||
| @@ -4,6 +4,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE) | |||
| 4 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 4 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 5 | 5 | ||
| 6 | static hsv_t SOLID_REACTIVE_SIMPLE_math(hsv_t hsv, uint16_t offset) { | 6 | static hsv_t SOLID_REACTIVE_SIMPLE_math(hsv_t hsv, uint16_t offset) { |
| 7 | if (offset > 255) offset = 255; | ||
| 7 | # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE | 8 | # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE |
| 8 | hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); | 9 | hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); |
| 9 | # endif | 10 | # endif |
