summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Y <76888457+filterpaper@users.noreply.github.com>2022-07-14 19:36:51 +0800
committerGitHub <noreply@github.com>2022-07-14 12:36:51 +0100
commit1862ac54540573843055b3b609b9f40d9f7dc21f (patch)
treed15ffd123f334d8c3ecf58cced92cdf6214ccafa
parentda4689d6b586a710d216ab9a7dc3550c346e2d87 (diff)
Fix the use of LED limits (#17678)
-rw-r--r--quantum/rgb_matrix/animations/raindrops_anim.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/quantum/rgb_matrix/animations/raindrops_anim.h b/quantum/rgb_matrix/animations/raindrops_anim.h
index 2d4b53b7b0..a508e51183 100644
--- a/quantum/rgb_matrix/animations/raindrops_anim.h
+++ b/quantum/rgb_matrix/animations/raindrops_anim.h
@@ -14,23 +14,22 @@ static void raindrops_set_color(int i, effect_params_t* params) {
deltaH += 256;
}
- hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03));
+ hsv.h = rgb_matrix_config.hsv.h + (deltaH * (random8() & 0x03));
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
}
bool RAINDROPS(effect_params_t* params) {
+ RGB_MATRIX_USE_LIMITS(led_min, led_max);
if (!params->init) {
// Change one LED every tick, make sure speed is not 0
if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
- raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
+ raindrops_set_color(random8() % DRIVER_LED_TOTAL, params);
+ }
+ } else {
+ for (int i = led_min; i < led_max; i++) {
+ raindrops_set_color(i, params);
}
- return false;
- }
-
- RGB_MATRIX_USE_LIMITS(led_min, led_max);
- for (int i = led_min; i < led_max; i++) {
- raindrops_set_color(i, params);
}
return rgb_matrix_check_finished_leds(led_max);
}