diff options
Diffstat (limited to 'quantum/rgb_matrix_animations')
32 files changed, 382 insertions, 458 deletions
diff --git a/quantum/rgb_matrix_animations/alpha_mods_anim.h b/quantum/rgb_matrix_animations/alpha_mods_anim.h index 8df3356f6..0778ab209 100644 --- a/quantum/rgb_matrix_animations/alpha_mods_anim.h +++ b/quantum/rgb_matrix_animations/alpha_mods_anim.h | |||
| @@ -1,26 +1,26 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS | 1 | #ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS |
| 2 | RGB_MATRIX_EFFECT(ALPHAS_MODS) | 2 | RGB_MATRIX_EFFECT(ALPHAS_MODS) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | // alphas = color1, mods = color2 | 5 | // alphas = color1, mods = color2 |
| 6 | bool ALPHAS_MODS(effect_params_t* params) { | 6 | bool ALPHAS_MODS(effect_params_t* params) { |
| 7 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 7 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 8 | 8 | ||
| 9 | HSV hsv = rgb_matrix_config.hsv; | 9 | HSV hsv = rgb_matrix_config.hsv; |
| 10 | RGB rgb1 = hsv_to_rgb(hsv); | 10 | RGB rgb1 = hsv_to_rgb(hsv); |
| 11 | hsv.h += rgb_matrix_config.speed; | 11 | hsv.h += rgb_matrix_config.speed; |
| 12 | RGB rgb2 = hsv_to_rgb(hsv); | 12 | RGB rgb2 = hsv_to_rgb(hsv); |
| 13 | 13 | ||
| 14 | for (uint8_t i = led_min; i < led_max; i++) { | 14 | for (uint8_t i = led_min; i < led_max; i++) { |
| 15 | RGB_MATRIX_TEST_LED_FLAGS(); | 15 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 16 | if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { | 16 | if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { |
| 17 | rgb_matrix_set_color(i, rgb2.r, rgb2.g, rgb2.b); | 17 | rgb_matrix_set_color(i, rgb2.r, rgb2.g, rgb2.b); |
| 18 | } else { | 18 | } else { |
| 19 | rgb_matrix_set_color(i, rgb1.r, rgb1.g, rgb1.b); | 19 | rgb_matrix_set_color(i, rgb1.r, rgb1.g, rgb1.b); |
| 20 | } | ||
| 20 | } | 21 | } |
| 21 | } | 22 | return led_max < DRIVER_LED_TOTAL; |
| 22 | return led_max < DRIVER_LED_TOTAL; | ||
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 25 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 26 | #endif // DISABLE_RGB_MATRIX_ALPHAS_MODS | 26 | #endif // DISABLE_RGB_MATRIX_ALPHAS_MODS |
diff --git a/quantum/rgb_matrix_animations/breathing_anim.h b/quantum/rgb_matrix_animations/breathing_anim.h index 0af7b42cf..92431555e 100644 --- a/quantum/rgb_matrix_animations/breathing_anim.h +++ b/quantum/rgb_matrix_animations/breathing_anim.h | |||
| @@ -1,20 +1,20 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_BREATHING | 1 | #ifndef DISABLE_RGB_MATRIX_BREATHING |
| 2 | RGB_MATRIX_EFFECT(BREATHING) | 2 | RGB_MATRIX_EFFECT(BREATHING) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | bool BREATHING(effect_params_t* params) { | 5 | bool BREATHING(effect_params_t* params) { |
| 6 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 6 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 7 | 7 | ||
| 8 | HSV hsv = rgb_matrix_config.hsv; | 8 | HSV hsv = rgb_matrix_config.hsv; |
| 9 | uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 8); | 9 | uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 8); |
| 10 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); | 10 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); |
| 11 | RGB rgb = hsv_to_rgb(hsv); | 11 | RGB rgb = hsv_to_rgb(hsv); |
| 12 | for (uint8_t i = led_min; i < led_max; i++) { | 12 | for (uint8_t i = led_min; i < led_max; i++) { |
| 13 | RGB_MATRIX_TEST_LED_FLAGS(); | 13 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 14 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 14 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 15 | } | 15 | } |
| 16 | return led_max < DRIVER_LED_TOTAL; | 16 | return led_max < DRIVER_LED_TOTAL; |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 19 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 20 | #endif // DISABLE_RGB_MATRIX_BREATHING | 20 | #endif // DISABLE_RGB_MATRIX_BREATHING |
diff --git a/quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h b/quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h index 4585c5271..3df3cfda7 100644 --- a/quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h +++ b/quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT | 1 | #ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT |
| 2 | RGB_MATRIX_EFFECT(BAND_PINWHEEL_SAT) | 2 | RGB_MATRIX_EFFECT(BAND_PINWHEEL_SAT) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV BAND_PINWHEEL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { | 5 | static HSV BAND_PINWHEEL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { |
| 6 | hsv.s = scale8(hsv.s - time - atan2_8(dy, dx) * 3, hsv.s); | 6 | hsv.s = scale8(hsv.s - time - atan2_8(dy, dx) * 3, hsv.s); |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool BAND_PINWHEEL_SAT(effect_params_t* params) { | 10 | bool BAND_PINWHEEL_SAT(effect_params_t* params) { return effect_runner_dx_dy(params, &BAND_PINWHEEL_SAT_math); } |
| 11 | return effect_runner_dx_dy(params, &BAND_PINWHEEL_SAT_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT | 13 | #endif // DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT |
diff --git a/quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h b/quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h index 5cdb87348..7d80074fd 100644 --- a/quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h +++ b/quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL | 1 | #ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL |
| 2 | RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL) | 2 | RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV BAND_PINWHEEL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { | 5 | static HSV BAND_PINWHEEL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { |
| 6 | hsv.v = scale8(hsv.v - time - atan2_8(dy, dx) * 3, hsv.v); | 6 | hsv.v = scale8(hsv.v - time - atan2_8(dy, dx) * 3, hsv.v); |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool BAND_PINWHEEL_VAL(effect_params_t* params) { | 10 | bool BAND_PINWHEEL_VAL(effect_params_t* params) { return effect_runner_dx_dy(params, &BAND_PINWHEEL_VAL_math); } |
| 11 | return effect_runner_dx_dy(params, &BAND_PINWHEEL_VAL_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL | 13 | #endif // DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL |
diff --git a/quantum/rgb_matrix_animations/colorband_sat_anim.h b/quantum/rgb_matrix_animations/colorband_sat_anim.h index a5175f1cd..35b830af6 100644 --- a/quantum/rgb_matrix_animations/colorband_sat_anim.h +++ b/quantum/rgb_matrix_animations/colorband_sat_anim.h | |||
| @@ -1,16 +1,14 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_BAND_SAT | 1 | #ifndef DISABLE_RGB_MATRIX_BAND_SAT |
| 2 | RGB_MATRIX_EFFECT(BAND_SAT) | 2 | RGB_MATRIX_EFFECT(BAND_SAT) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV BAND_SAT_math(HSV hsv, uint8_t i, uint8_t time) { | 5 | static HSV BAND_SAT_math(HSV hsv, uint8_t i, uint8_t time) { |
| 6 | int16_t s = hsv.s - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; | 6 | int16_t s = hsv.s - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; |
| 7 | hsv.s = scale8(s < 0 ? 0 : s, hsv.s); | 7 | hsv.s = scale8(s < 0 ? 0 : s, hsv.s); |
| 8 | return hsv; | 8 | return hsv; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | bool BAND_SAT(effect_params_t* params) { | 11 | bool BAND_SAT(effect_params_t* params) { return effect_runner_i(params, &BAND_SAT_math); } |
| 12 | return effect_runner_i(params, &BAND_SAT_math); | ||
| 13 | } | ||
| 14 | 12 | ||
| 15 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 13 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 16 | #endif // DISABLE_RGB_MATRIX_BAND_SAT | 14 | #endif // DISABLE_RGB_MATRIX_BAND_SAT |
diff --git a/quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h b/quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h index 096c675de..048157aa1 100644 --- a/quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h +++ b/quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT | 1 | #ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT |
| 2 | RGB_MATRIX_EFFECT(BAND_SPIRAL_SAT) | 2 | RGB_MATRIX_EFFECT(BAND_SPIRAL_SAT) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV BAND_SPIRAL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { | 5 | static HSV BAND_SPIRAL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { |
| 6 | hsv.s = scale8(hsv.s + dist - time - atan2_8(dy, dx), hsv.s); | 6 | hsv.s = scale8(hsv.s + dist - time - atan2_8(dy, dx), hsv.s); |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool BAND_SPIRAL_SAT(effect_params_t* params) { | 10 | bool BAND_SPIRAL_SAT(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_SAT_math); } |
| 11 | return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_SAT_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT | 13 | #endif // DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT |
diff --git a/quantum/rgb_matrix_animations/colorband_spiral_val_anim.h b/quantum/rgb_matrix_animations/colorband_spiral_val_anim.h index 1d4cc0c84..bff2da161 100644 --- a/quantum/rgb_matrix_animations/colorband_spiral_val_anim.h +++ b/quantum/rgb_matrix_animations/colorband_spiral_val_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL | 1 | #ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL |
| 2 | RGB_MATRIX_EFFECT(BAND_SPIRAL_VAL) | 2 | RGB_MATRIX_EFFECT(BAND_SPIRAL_VAL) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV BAND_SPIRAL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { | 5 | static HSV BAND_SPIRAL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { |
| 6 | hsv.v = scale8(hsv.v + dist - time - atan2_8(dy, dx), hsv.v); | 6 | hsv.v = scale8(hsv.v + dist - time - atan2_8(dy, dx), hsv.v); |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool BAND_SPIRAL_VAL(effect_params_t* params) { | 10 | bool BAND_SPIRAL_VAL(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_VAL_math); } |
| 11 | return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_VAL_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL | 13 | #endif // DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL |
diff --git a/quantum/rgb_matrix_animations/colorband_val_anim.h b/quantum/rgb_matrix_animations/colorband_val_anim.h index de0bbb471..f1aaf1d06 100644 --- a/quantum/rgb_matrix_animations/colorband_val_anim.h +++ b/quantum/rgb_matrix_animations/colorband_val_anim.h | |||
| @@ -1,16 +1,14 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_BAND_VAL | 1 | #ifndef DISABLE_RGB_MATRIX_BAND_VAL |
| 2 | RGB_MATRIX_EFFECT(BAND_VAL) | 2 | RGB_MATRIX_EFFECT(BAND_VAL) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV BAND_VAL_math(HSV hsv, uint8_t i, uint8_t time) { | 5 | static HSV BAND_VAL_math(HSV hsv, uint8_t i, uint8_t time) { |
| 6 | int16_t v = hsv.v - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; | 6 | int16_t v = hsv.v - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; |
| 7 | hsv.v = scale8(v < 0 ? 0 : v, hsv.v); | 7 | hsv.v = scale8(v < 0 ? 0 : v, hsv.v); |
| 8 | return hsv; | 8 | return hsv; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | bool BAND_VAL(effect_params_t* params) { | 11 | bool BAND_VAL(effect_params_t* params) { return effect_runner_i(params, &BAND_VAL_math); } |
| 12 | return effect_runner_i(params, &BAND_VAL_math); | ||
| 13 | } | ||
| 14 | 12 | ||
| 15 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 13 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 16 | #endif // DISABLE_RGB_MATRIX_BAND_VAL | 14 | #endif // DISABLE_RGB_MATRIX_BAND_VAL |
diff --git a/quantum/rgb_matrix_animations/cycle_all_anim.h b/quantum/rgb_matrix_animations/cycle_all_anim.h index 0c45aba8b..faf8598a3 100644 --- a/quantum/rgb_matrix_animations/cycle_all_anim.h +++ b/quantum/rgb_matrix_animations/cycle_all_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_ALL | 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_ALL |
| 2 | RGB_MATRIX_EFFECT(CYCLE_ALL) | 2 | RGB_MATRIX_EFFECT(CYCLE_ALL) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_ALL_math(HSV hsv, uint8_t i, uint8_t time){ | 5 | static HSV CYCLE_ALL_math(HSV hsv, uint8_t i, uint8_t time) { |
| 6 | hsv.h = time; | 6 | hsv.h = time; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool CYCLE_ALL(effect_params_t* params) { | 10 | bool CYCLE_ALL(effect_params_t* params) { return effect_runner_i(params, &CYCLE_ALL_math); } |
| 11 | return effect_runner_i(params, &CYCLE_ALL_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_CYCLE_ALL | 13 | #endif // DISABLE_RGB_MATRIX_CYCLE_ALL |
diff --git a/quantum/rgb_matrix_animations/cycle_left_right_anim.h b/quantum/rgb_matrix_animations/cycle_left_right_anim.h index d2e5b4fbd..cf911eb93 100644 --- a/quantum/rgb_matrix_animations/cycle_left_right_anim.h +++ b/quantum/rgb_matrix_animations/cycle_left_right_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT | 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT |
| 2 | RGB_MATRIX_EFFECT(CYCLE_LEFT_RIGHT) | 2 | RGB_MATRIX_EFFECT(CYCLE_LEFT_RIGHT) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_LEFT_RIGHT_math(HSV hsv, uint8_t i, uint8_t time) { | 5 | static HSV CYCLE_LEFT_RIGHT_math(HSV hsv, uint8_t i, uint8_t time) { |
| 6 | hsv.h = g_led_config.point[i].x - time; | 6 | hsv.h = g_led_config.point[i].x - time; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool CYCLE_LEFT_RIGHT(effect_params_t* params) { | 10 | bool CYCLE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math); } |
| 11 | return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT | 13 | #endif // DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT |
diff --git a/quantum/rgb_matrix_animations/cycle_out_in_anim.h b/quantum/rgb_matrix_animations/cycle_out_in_anim.h index fa7c3b09c..d66acd4b2 100644 --- a/quantum/rgb_matrix_animations/cycle_out_in_anim.h +++ b/quantum/rgb_matrix_animations/cycle_out_in_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN | 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN |
| 2 | RGB_MATRIX_EFFECT(CYCLE_OUT_IN) | 2 | RGB_MATRIX_EFFECT(CYCLE_OUT_IN) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_OUT_IN_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { | 5 | static HSV CYCLE_OUT_IN_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { |
| 6 | hsv.h = 3 * dist / 2 + time; | 6 | hsv.h = 3 * dist / 2 + time; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool CYCLE_OUT_IN(effect_params_t* params) { | 10 | bool CYCLE_OUT_IN(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math); } |
| 11 | return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_CYCLE_OUT_IN | 13 | #endif // DISABLE_RGB_MATRIX_CYCLE_OUT_IN |
diff --git a/quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h b/quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h index 74a2c9aa5..fe8396140 100644 --- a/quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h +++ b/quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h | |||
| @@ -1,17 +1,15 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL | 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL |
| 2 | RGB_MATRIX_EFFECT(CYCLE_OUT_IN_DUAL) | 2 | RGB_MATRIX_EFFECT(CYCLE_OUT_IN_DUAL) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_OUT_IN_DUAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { | 5 | static HSV CYCLE_OUT_IN_DUAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { |
| 6 | dx = (k_rgb_matrix_center.x / 2) - abs8(dx); | 6 | dx = (k_rgb_matrix_center.x / 2) - abs8(dx); |
| 7 | uint8_t dist = sqrt16(dx * dx + dy * dy); | 7 | uint8_t dist = sqrt16(dx * dx + dy * dy); |
| 8 | hsv.h = 3 * dist + time; | 8 | hsv.h = 3 * dist + time; |
| 9 | return hsv; | 9 | return hsv; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | bool CYCLE_OUT_IN_DUAL(effect_params_t* params) { | 12 | bool CYCLE_OUT_IN_DUAL(effect_params_t* params) { return effect_runner_dx_dy(params, &CYCLE_OUT_IN_DUAL_math); } |
| 13 | return effect_runner_dx_dy(params, &CYCLE_OUT_IN_DUAL_math); | ||
| 14 | } | ||
| 15 | 13 | ||
| 16 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 14 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 17 | #endif // DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL | 15 | #endif // DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL |
diff --git a/quantum/rgb_matrix_animations/cycle_pinwheel_anim.h b/quantum/rgb_matrix_animations/cycle_pinwheel_anim.h index 54e222dc2..779988709 100644 --- a/quantum/rgb_matrix_animations/cycle_pinwheel_anim.h +++ b/quantum/rgb_matrix_animations/cycle_pinwheel_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_PINWHEEL | 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_PINWHEEL |
| 2 | RGB_MATRIX_EFFECT(CYCLE_PINWHEEL) | 2 | RGB_MATRIX_EFFECT(CYCLE_PINWHEEL) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_PINWHEEL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { | 5 | static HSV CYCLE_PINWHEEL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { |
| 6 | hsv.h = atan2_8(dy, dx) + time; | 6 | hsv.h = atan2_8(dy, dx) + time; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool CYCLE_PINWHEEL(effect_params_t* params) { | 10 | bool CYCLE_PINWHEEL(effect_params_t* params) { return effect_runner_dx_dy(params, &CYCLE_PINWHEEL_math); } |
| 11 | return effect_runner_dx_dy(params, &CYCLE_PINWHEEL_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_CYCLE_PINWHEEL | 13 | #endif // DISABLE_RGB_MATRIX_CYCLE_PINWHEEL |
diff --git a/quantum/rgb_matrix_animations/cycle_spiral_anim.h b/quantum/rgb_matrix_animations/cycle_spiral_anim.h index b27d7a83c..80cfb0dbc 100644 --- a/quantum/rgb_matrix_animations/cycle_spiral_anim.h +++ b/quantum/rgb_matrix_animations/cycle_spiral_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_SPIRAL | 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_SPIRAL |
| 2 | RGB_MATRIX_EFFECT(CYCLE_SPIRAL) | 2 | RGB_MATRIX_EFFECT(CYCLE_SPIRAL) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_SPIRAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { | 5 | static HSV CYCLE_SPIRAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { |
| 6 | hsv.h = dist - time - atan2_8(dy, dx); | 6 | hsv.h = dist - time - atan2_8(dy, dx); |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool CYCLE_SPIRAL(effect_params_t* params) { | 10 | bool CYCLE_SPIRAL(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &CYCLE_SPIRAL_math); } |
| 11 | return effect_runner_dx_dy_dist(params, &CYCLE_SPIRAL_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_CYCLE_SPIRAL | 13 | #endif // DISABLE_RGB_MATRIX_CYCLE_SPIRAL |
diff --git a/quantum/rgb_matrix_animations/cycle_up_down_anim.h b/quantum/rgb_matrix_animations/cycle_up_down_anim.h index 4bf8ef2ae..5016f739d 100644 --- a/quantum/rgb_matrix_animations/cycle_up_down_anim.h +++ b/quantum/rgb_matrix_animations/cycle_up_down_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN | 1 | #ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN |
| 2 | RGB_MATRIX_EFFECT(CYCLE_UP_DOWN) | 2 | RGB_MATRIX_EFFECT(CYCLE_UP_DOWN) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_UP_DOWN_math(HSV hsv, uint8_t i, uint8_t time) { | 5 | static HSV CYCLE_UP_DOWN_math(HSV hsv, uint8_t i, uint8_t time) { |
| 6 | hsv.h = g_led_config.point[i].y - time; | 6 | hsv.h = g_led_config.point[i].y - time; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool CYCLE_UP_DOWN(effect_params_t* params) { | 10 | bool CYCLE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &CYCLE_UP_DOWN_math); } |
| 11 | return effect_runner_i(params, &CYCLE_UP_DOWN_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_CYCLE_UP_DOWN | 13 | #endif // DISABLE_RGB_MATRIX_CYCLE_UP_DOWN |
diff --git a/quantum/rgb_matrix_animations/digital_rain_anim.h b/quantum/rgb_matrix_animations/digital_rain_anim.h index 982399cbd..7a4a52db1 100644 --- a/quantum/rgb_matrix_animations/digital_rain_anim.h +++ b/quantum/rgb_matrix_animations/digital_rain_anim.h | |||
| @@ -1,77 +1,75 @@ | |||
| 1 | #if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_DIGITAL_RAIN) | 1 | #if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_DIGITAL_RAIN) |
| 2 | RGB_MATRIX_EFFECT(DIGITAL_RAIN) | 2 | RGB_MATRIX_EFFECT(DIGITAL_RAIN) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | #ifndef RGB_DIGITAL_RAIN_DROPS | 5 | # ifndef RGB_DIGITAL_RAIN_DROPS |
| 6 | // lower the number for denser effect/wider keyboard | 6 | // lower the number for denser effect/wider keyboard |
| 7 | #define RGB_DIGITAL_RAIN_DROPS 24 | 7 | # define RGB_DIGITAL_RAIN_DROPS 24 |
| 8 | #endif | 8 | # endif |
| 9 | 9 | ||
| 10 | bool DIGITAL_RAIN(effect_params_t* params) { | 10 | bool DIGITAL_RAIN(effect_params_t* params) { |
| 11 | // algorithm ported from https://github.com/tremby/Kaleidoscope-LEDEffect-DigitalRain | 11 | // algorithm ported from https://github.com/tremby/Kaleidoscope-LEDEffect-DigitalRain |
| 12 | const uint8_t drop_ticks = 28; | 12 | const uint8_t drop_ticks = 28; |
| 13 | const uint8_t pure_green_intensity = 0xd0; | 13 | const uint8_t pure_green_intensity = 0xd0; |
| 14 | const uint8_t max_brightness_boost = 0xc0; | 14 | const uint8_t max_brightness_boost = 0xc0; |
| 15 | const uint8_t max_intensity = 0xff; | 15 | const uint8_t max_intensity = 0xff; |
| 16 | 16 | ||
| 17 | static uint8_t drop = 0; | 17 | static uint8_t drop = 0; |
| 18 | 18 | ||
| 19 | if (params->init) { | 19 | if (params->init) { |
| 20 | rgb_matrix_set_color_all(0, 0, 0); | 20 | rgb_matrix_set_color_all(0, 0, 0); |
| 21 | memset(rgb_frame_buffer, 0, sizeof(rgb_frame_buffer)); | 21 | memset(rgb_frame_buffer, 0, sizeof(rgb_frame_buffer)); |
| 22 | drop = 0; | 22 | drop = 0; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | 25 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { |
| 26 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | 26 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { |
| 27 | if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) { | 27 | if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) { |
| 28 | // top row, pixels have just fallen and we're | 28 | // top row, pixels have just fallen and we're |
| 29 | // making a new rain drop in this column | 29 | // making a new rain drop in this column |
| 30 | rgb_frame_buffer[row][col] = max_intensity; | 30 | rgb_frame_buffer[row][col] = max_intensity; |
| 31 | } | 31 | } else if (rgb_frame_buffer[row][col] > 0 && rgb_frame_buffer[row][col] < max_intensity) { |
| 32 | else if (rgb_frame_buffer[row][col] > 0 && rgb_frame_buffer[row][col] < max_intensity) { | 32 | // neither fully bright nor dark, decay it |
| 33 | // neither fully bright nor dark, decay it | 33 | rgb_frame_buffer[row][col]--; |
| 34 | rgb_frame_buffer[row][col]--; | 34 | } |
| 35 | } | 35 | // set the pixel colour |
| 36 | // set the pixel colour | 36 | uint8_t led[LED_HITS_TO_REMEMBER]; |
| 37 | uint8_t led[LED_HITS_TO_REMEMBER]; | 37 | uint8_t led_count = rgb_matrix_map_row_column_to_led(row, col, led); |
| 38 | uint8_t led_count = rgb_matrix_map_row_column_to_led(row, col, led); | ||
| 39 | 38 | ||
| 40 | // TODO: multiple leds are supported mapped to the same row/column | 39 | // TODO: multiple leds are supported mapped to the same row/column |
| 41 | if (led_count > 0) { | 40 | if (led_count > 0) { |
| 42 | if (rgb_frame_buffer[row][col] > pure_green_intensity) { | 41 | if (rgb_frame_buffer[row][col] > pure_green_intensity) { |
| 43 | const uint8_t boost = (uint8_t) ((uint16_t) max_brightness_boost * (rgb_frame_buffer[row][col] - pure_green_intensity) / (max_intensity - pure_green_intensity)); | 42 | const uint8_t boost = (uint8_t)((uint16_t)max_brightness_boost * (rgb_frame_buffer[row][col] - pure_green_intensity) / (max_intensity - pure_green_intensity)); |
| 44 | rgb_matrix_set_color(led[0], boost, max_intensity, boost); | 43 | rgb_matrix_set_color(led[0], boost, max_intensity, boost); |
| 45 | } | 44 | } else { |
| 46 | else { | 45 | const uint8_t green = (uint8_t)((uint16_t)max_intensity * rgb_frame_buffer[row][col] / pure_green_intensity); |
| 47 | const uint8_t green = (uint8_t) ((uint16_t) max_intensity * rgb_frame_buffer[row][col] / pure_green_intensity); | 46 | rgb_matrix_set_color(led[0], 0, green, 0); |
| 48 | rgb_matrix_set_color(led[0], 0, green, 0); | 47 | } |
| 48 | } | ||
| 49 | } | 49 | } |
| 50 | } | ||
| 51 | } | 50 | } |
| 52 | } | ||
| 53 | 51 | ||
| 54 | if (++drop > drop_ticks) { | 52 | if (++drop > drop_ticks) { |
| 55 | // reset drop timer | 53 | // reset drop timer |
| 56 | drop = 0; | 54 | drop = 0; |
| 57 | for (uint8_t row = MATRIX_ROWS - 1; row > 0; row--) { | 55 | for (uint8_t row = MATRIX_ROWS - 1; row > 0; row--) { |
| 58 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | 56 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { |
| 59 | // if ths is on the bottom row and bright allow decay | 57 | // if ths is on the bottom row and bright allow decay |
| 60 | if (row == MATRIX_ROWS - 1 && rgb_frame_buffer[row][col] == max_intensity) { | 58 | if (row == MATRIX_ROWS - 1 && rgb_frame_buffer[row][col] == max_intensity) { |
| 61 | rgb_frame_buffer[row][col]--; | 59 | rgb_frame_buffer[row][col]--; |
| 62 | } | 60 | } |
| 63 | // check if the pixel above is bright | 61 | // check if the pixel above is bright |
| 64 | if (rgb_frame_buffer[row - 1][col] == max_intensity) { | 62 | if (rgb_frame_buffer[row - 1][col] == max_intensity) { |
| 65 | // allow old bright pixel to decay | 63 | // allow old bright pixel to decay |
| 66 | rgb_frame_buffer[row - 1][col]--; | 64 | rgb_frame_buffer[row - 1][col]--; |
| 67 | // make this pixel bright | 65 | // make this pixel bright |
| 68 | rgb_frame_buffer[row][col] = max_intensity; | 66 | rgb_frame_buffer[row][col] = max_intensity; |
| 67 | } | ||
| 68 | } | ||
| 69 | } | 69 | } |
| 70 | } | ||
| 71 | } | 70 | } |
| 72 | } | 71 | return false; |
| 73 | return false; | ||
| 74 | } | 72 | } |
| 75 | 73 | ||
| 76 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 74 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 77 | #endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_DIGITAL_RAIN) | 75 | #endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_DIGITAL_RAIN) |
diff --git a/quantum/rgb_matrix_animations/dual_beacon_anim.h b/quantum/rgb_matrix_animations/dual_beacon_anim.h index 336a41b2c..ce9487168 100644 --- a/quantum/rgb_matrix_animations/dual_beacon_anim.h +++ b/quantum/rgb_matrix_animations/dual_beacon_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_DUAL_BEACON | 1 | #ifndef DISABLE_RGB_MATRIX_DUAL_BEACON |
| 2 | RGB_MATRIX_EFFECT(DUAL_BEACON) | 2 | RGB_MATRIX_EFFECT(DUAL_BEACON) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV DUAL_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { | 5 | static HSV DUAL_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { |
| 6 | hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * sin) / 128; | 6 | hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * sin) / 128; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool DUAL_BEACON(effect_params_t* params) { | 10 | bool DUAL_BEACON(effect_params_t* params) { return effect_runner_sin_cos_i(params, &DUAL_BEACON_math); } |
| 11 | return effect_runner_sin_cos_i(params, &DUAL_BEACON_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_DUAL_BEACON | 13 | #endif // DISABLE_RGB_MATRIX_DUAL_BEACON |
diff --git a/quantum/rgb_matrix_animations/gradient_up_down_anim.h b/quantum/rgb_matrix_animations/gradient_up_down_anim.h index 12848ab4c..0f1f8e23c 100644 --- a/quantum/rgb_matrix_animations/gradient_up_down_anim.h +++ b/quantum/rgb_matrix_animations/gradient_up_down_anim.h | |||
| @@ -1,22 +1,22 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN | 1 | #ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN |
| 2 | RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN) | 2 | RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | bool GRADIENT_UP_DOWN(effect_params_t* params) { | 5 | bool GRADIENT_UP_DOWN(effect_params_t* params) { |
| 6 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 6 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 7 | 7 | ||
| 8 | HSV hsv = rgb_matrix_config.hsv; | 8 | HSV hsv = rgb_matrix_config.hsv; |
| 9 | uint8_t scale = scale8(64, rgb_matrix_config.speed); | 9 | uint8_t scale = scale8(64, rgb_matrix_config.speed); |
| 10 | for (uint8_t i = led_min; i < led_max; i++) { | 10 | for (uint8_t i = led_min; i < led_max; i++) { |
| 11 | RGB_MATRIX_TEST_LED_FLAGS(); | 11 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 12 | // The y range will be 0..64, map this to 0..4 | 12 | // The y range will be 0..64, map this to 0..4 |
| 13 | // Relies on hue being 8-bit and wrapping | 13 | // Relies on hue being 8-bit and wrapping |
| 14 | hsv.h = rgb_matrix_config.hsv.h + scale * (g_led_config.point[i].y >> 4); | 14 | hsv.h = rgb_matrix_config.hsv.h + scale * (g_led_config.point[i].y >> 4); |
| 15 | RGB rgb = hsv_to_rgb(hsv); | 15 | RGB rgb = hsv_to_rgb(hsv); |
| 16 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 16 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 17 | } | 17 | } |
| 18 | return led_max < DRIVER_LED_TOTAL; | 18 | return led_max < DRIVER_LED_TOTAL; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 21 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 22 | #endif // DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN | 22 | #endif // DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN |
diff --git a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h index bffa0a42d..5596146a3 100644 --- a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h +++ b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h | |||
| @@ -1,29 +1,29 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS | 1 | #ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS |
| 2 | RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS) | 2 | RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static void jellybean_raindrops_set_color(int i, effect_params_t* params) { | 5 | static void jellybean_raindrops_set_color(int i, effect_params_t* params) { |
| 6 | if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; | 6 | if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; |
| 7 | HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.hsv.v }; | 7 | HSV hsv = {rand() & 0xFF, rand() & 0xFF, rgb_matrix_config.hsv.v}; |
| 8 | RGB rgb = hsv_to_rgb(hsv); | 8 | RGB rgb = hsv_to_rgb(hsv); |
| 9 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 9 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | bool JELLYBEAN_RAINDROPS(effect_params_t* params) { | 12 | bool JELLYBEAN_RAINDROPS(effect_params_t* params) { |
| 13 | if (!params->init) { | 13 | if (!params->init) { |
| 14 | // Change one LED every tick, make sure speed is not 0 | 14 | // Change one LED every tick, make sure speed is not 0 |
| 15 | if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) { | 15 | if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) { |
| 16 | jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params); | 16 | jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params); |
| 17 | } | ||
| 18 | return false; | ||
| 17 | } | 19 | } |
| 18 | return false; | ||
| 19 | } | ||
| 20 | 20 | ||
| 21 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 21 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 22 | for (int i = led_min; i < led_max; i++) { | 22 | for (int i = led_min; i < led_max; i++) { |
| 23 | jellybean_raindrops_set_color(i, params); | 23 | jellybean_raindrops_set_color(i, params); |
| 24 | } | 24 | } |
| 25 | return led_max < DRIVER_LED_TOTAL; | 25 | return led_max < DRIVER_LED_TOTAL; |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 28 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 29 | #endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS | 29 | #endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS |
diff --git a/quantum/rgb_matrix_animations/rainbow_beacon_anim.h b/quantum/rgb_matrix_animations/rainbow_beacon_anim.h index f53c819a9..977261182 100644 --- a/quantum/rgb_matrix_animations/rainbow_beacon_anim.h +++ b/quantum/rgb_matrix_animations/rainbow_beacon_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON | 1 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON |
| 2 | RGB_MATRIX_EFFECT(RAINBOW_BEACON) | 2 | RGB_MATRIX_EFFECT(RAINBOW_BEACON) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV RAINBOW_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { | 5 | static HSV RAINBOW_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { |
| 6 | hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 2 * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * 2 * sin) / 128; | 6 | hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 2 * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * 2 * sin) / 128; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool RAINBOW_BEACON(effect_params_t* params) { | 10 | bool RAINBOW_BEACON(effect_params_t* params) { return effect_runner_sin_cos_i(params, &RAINBOW_BEACON_math); } |
| 11 | return effect_runner_sin_cos_i(params, &RAINBOW_BEACON_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_RAINBOW_BEACON | 13 | #endif // DISABLE_RGB_MATRIX_RAINBOW_BEACON |
diff --git a/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h b/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h index e78c55e8d..e51e7b251 100644 --- a/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h +++ b/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON | 1 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON |
| 2 | RGB_MATRIX_EFFECT(RAINBOW_MOVING_CHEVRON) | 2 | RGB_MATRIX_EFFECT(RAINBOW_MOVING_CHEVRON) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV RAINBOW_MOVING_CHEVRON_math(HSV hsv, uint8_t i, uint8_t time) { | 5 | static HSV RAINBOW_MOVING_CHEVRON_math(HSV hsv, uint8_t i, uint8_t time) { |
| 6 | hsv.h += abs8(g_led_config.point[i].y - k_rgb_matrix_center.y) + (g_led_config.point[i].x - time); | 6 | hsv.h += abs8(g_led_config.point[i].y - k_rgb_matrix_center.y) + (g_led_config.point[i].x - time); |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) { | 10 | bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) { return effect_runner_i(params, &RAINBOW_MOVING_CHEVRON_math); } |
| 11 | return effect_runner_i(params, &RAINBOW_MOVING_CHEVRON_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON | 13 | #endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON |
diff --git a/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h b/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h index 8298fec46..4f69456c3 100644 --- a/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h +++ b/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS | 1 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS |
| 2 | RGB_MATRIX_EFFECT(PINWHEELS) | 2 | RGB_MATRIX_EFFECT(PINWHEELS) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV PINWHEELS_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { | 5 | static HSV PINWHEELS_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { |
| 6 | hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 3 * cos + (56 - abs8(g_led_config.point[i].x - k_rgb_matrix_center.x)) * 3 * sin) / 128; | 6 | hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 3 * cos + (56 - abs8(g_led_config.point[i].x - k_rgb_matrix_center.x)) * 3 * sin) / 128; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | bool PINWHEELS(effect_params_t* params) { | 10 | bool PINWHEELS(effect_params_t* params) { return effect_runner_sin_cos_i(params, &PINWHEELS_math); } |
| 11 | return effect_runner_sin_cos_i(params, &PINWHEELS_math); | ||
| 12 | } | ||
| 13 | 11 | ||
| 14 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 15 | #endif // DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS | 13 | #endif // DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS |
diff --git a/quantum/rgb_matrix_animations/raindrops_anim.h b/quantum/rgb_matrix_animations/raindrops_anim.h index a4fed5165..9f839a1bc 100644 --- a/quantum/rgb_matrix_animations/raindrops_anim.h +++ b/quantum/rgb_matrix_animations/raindrops_anim.h | |||
| @@ -1,39 +1,39 @@ | |||
| 1 | #ifndef DISABLE_RGB_MATRIX_RAINDROPS | 1 | #ifndef DISABLE_RGB_MATRIX_RAINDROPS |
| 2 | RGB_MATRIX_EFFECT(RAINDROPS) | 2 | RGB_MATRIX_EFFECT(RAINDROPS) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static void raindrops_set_color(int i, effect_params_t* params) { | 5 | static void raindrops_set_color(int i, effect_params_t* params) { |
| 6 | if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; | 6 | if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; |
| 7 | HSV hsv = { 0 , rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v }; | 7 | HSV hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; |
| 8 | 8 | ||
| 9 | // Take the shortest path between hues | 9 | // Take the shortest path between hues |
| 10 | int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4; | 10 | int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4; |
| 11 | if (deltaH > 127) { | 11 | if (deltaH > 127) { |
| 12 | deltaH -= 256; | 12 | deltaH -= 256; |
| 13 | } else if (deltaH < -127) { | 13 | } else if (deltaH < -127) { |
| 14 | deltaH += 256; | 14 | deltaH += 256; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); | 17 | hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); |
| 18 | RGB rgb = hsv_to_rgb(hsv); | 18 | RGB rgb = hsv_to_rgb(hsv); |
| 19 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 19 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | bool RAINDROPS(effect_params_t* params) { | 22 | bool RAINDROPS(effect_params_t* params) { |
| 23 | if (!params->init) { | 23 | if (!params->init) { |
| 24 | // Change one LED every tick, make sure speed is not 0 | 24 | // Change one LED every tick, make sure speed is not 0 |
| 25 | if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) { | 25 | if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) { |
| 26 | raindrops_set_color(rand() % DRIVER_LED_TOTAL, params); | 26 | raindrops_set_color(rand() % DRIVER_LED_TOTAL, params); |
| 27 | } | ||
| 28 | return false; | ||
| 27 | } | 29 | } |
| 28 | return false; | ||
| 29 | } | ||
| 30 | 30 | ||
| 31 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 31 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 32 | for (int i = led_min; i < led_max; i++) { | 32 | for (int i = led_min; i < led_max; i++) { |
| 33 | raindrops_set_color(i, params); | 33 | raindrops_set_color(i, params); |
| 34 | } | 34 | } |
| 35 | return led_max < DRIVER_LED_TOTAL; | 35 | return led_max < DRIVER_LED_TOTAL; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 38 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 39 | #endif // DISABLE_RGB_MATRIX_RAINDROPS | 39 | #endif // DISABLE_RGB_MATRIX_RAINDROPS |
diff --git a/quantum/rgb_matrix_animations/solid_color_anim.h b/quantum/rgb_matrix_animations/solid_color_anim.h index 6e4063803..c8f5e70e7 100644 --- a/quantum/rgb_matrix_animations/solid_color_anim.h +++ b/quantum/rgb_matrix_animations/solid_color_anim.h | |||
| @@ -2,14 +2,14 @@ RGB_MATRIX_EFFECT(SOLID_COLOR) | |||
| 2 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 2 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 3 | 3 | ||
| 4 | bool SOLID_COLOR(effect_params_t* params) { | 4 | bool SOLID_COLOR(effect_params_t* params) { |
| 5 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 5 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 6 | 6 | ||
| 7 | RGB rgb = hsv_to_rgb(rgb_matrix_config.hsv); | 7 | RGB rgb = hsv_to_rgb(rgb_matrix_config.hsv); |
| 8 | for (uint8_t i = led_min; i < led_max; i++) { | 8 | for (uint8_t i = led_min; i < led_max; i++) { |
| 9 | RGB_MATRIX_TEST_LED_FLAGS(); | 9 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 10 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 10 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 11 | } | 11 | } |
| 12 | return led_max < DRIVER_LED_TOTAL; | 12 | return led_max < DRIVER_LED_TOTAL; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 15 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
diff --git a/quantum/rgb_matrix_animations/solid_reactive_anim.h b/quantum/rgb_matrix_animations/solid_reactive_anim.h index dd49b6530..d45bb961b 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_anim.h +++ b/quantum/rgb_matrix_animations/solid_reactive_anim.h | |||
| @@ -1,17 +1,15 @@ | |||
| 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 2 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE | 2 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE |
| 3 | RGB_MATRIX_EFFECT(SOLID_REACTIVE) | 3 | RGB_MATRIX_EFFECT(SOLID_REACTIVE) |
| 4 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 4 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 5 | 5 | ||
| 6 | static HSV SOLID_REACTIVE_math(HSV hsv, uint16_t offset) { | 6 | static HSV SOLID_REACTIVE_math(HSV hsv, uint16_t offset) { |
| 7 | hsv.h += qsub8(130, offset); | 7 | hsv.h += qsub8(130, offset); |
| 8 | return hsv; | 8 | return hsv; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | bool SOLID_REACTIVE(effect_params_t* params) { | 11 | bool SOLID_REACTIVE(effect_params_t* params) { return effect_runner_reactive(params, &SOLID_REACTIVE_math); } |
| 12 | return effect_runner_reactive(params, &SOLID_REACTIVE_math); | ||
| 13 | } | ||
| 14 | 12 | ||
| 15 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 13 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 16 | #endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE | 14 | # endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE |
| 17 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED | 15 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED |
diff --git a/quantum/rgb_matrix_animations/solid_reactive_cross.h b/quantum/rgb_matrix_animations/solid_reactive_cross.h index 5b9cfcbd5..f76c68e8c 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_cross.h +++ b/quantum/rgb_matrix_animations/solid_reactive_cross.h | |||
| @@ -1,41 +1,36 @@ | |||
| 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 2 | #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) | 2 | # if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) |
| 3 | 3 | ||
| 4 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS | 4 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS |
| 5 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_CROSS) | 5 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_CROSS) |
| 6 | #endif | 6 | # endif |
| 7 | 7 | ||
| 8 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS | 8 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS |
| 9 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS) | 9 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS) |
| 10 | #endif | 10 | # endif |
| 11 | 11 | ||
| 12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 13 | 13 | ||
| 14 | static HSV SOLID_REACTIVE_CROSS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | 14 | static HSV SOLID_REACTIVE_CROSS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { |
| 15 | uint16_t effect = tick + dist; | 15 | uint16_t effect = tick + dist; |
| 16 | dx = dx < 0 ? dx * -1 : dx; | 16 | dx = dx < 0 ? dx * -1 : dx; |
| 17 | dy = dy < 0 ? dy * -1 : dy; | 17 | dy = dy < 0 ? dy * -1 : dy; |
| 18 | dx = dx * 16 > 255 ? 255 : dx * 16; | 18 | dx = dx * 16 > 255 ? 255 : dx * 16; |
| 19 | dy = dy * 16 > 255 ? 255 : dy * 16; | 19 | dy = dy * 16 > 255 ? 255 : dy * 16; |
| 20 | effect += dx > dy ? dy : dx; | 20 | effect += dx > dy ? dy : dx; |
| 21 | if (effect > 255) | 21 | if (effect > 255) effect = 255; |
| 22 | effect = 255; | ||
| 23 | hsv.v = qadd8(hsv.v, 255 - effect); | 22 | hsv.v = qadd8(hsv.v, 255 - effect); |
| 24 | return hsv; | 23 | return hsv; |
| 25 | } | 24 | } |
| 26 | 25 | ||
| 27 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS | 26 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS |
| 28 | bool SOLID_REACTIVE_CROSS(effect_params_t* params) { | 27 | bool SOLID_REACTIVE_CROSS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math); } |
| 29 | return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math); | 28 | # endif |
| 30 | } | ||
| 31 | #endif | ||
| 32 | 29 | ||
| 33 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS | 30 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS |
| 34 | bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { | 31 | bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); } |
| 35 | return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); | 32 | # endif |
| 36 | } | ||
| 37 | #endif | ||
| 38 | 33 | ||
| 39 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 34 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 40 | #endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) | 35 | # endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) |
| 41 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED | 36 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED |
diff --git a/quantum/rgb_matrix_animations/solid_reactive_nexus.h b/quantum/rgb_matrix_animations/solid_reactive_nexus.h index e90eaf4b2..17f94e3c1 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_nexus.h +++ b/quantum/rgb_matrix_animations/solid_reactive_nexus.h | |||
| @@ -1,41 +1,34 @@ | |||
| 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 2 | #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) | 2 | # if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) |
| 3 | 3 | ||
| 4 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS | 4 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS |
| 5 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS) | 5 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS) |
| 6 | #endif | 6 | # endif |
| 7 | 7 | ||
| 8 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS | 8 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS |
| 9 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS) | 9 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS) |
| 10 | #endif | 10 | # endif |
| 11 | 11 | ||
| 12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 13 | 13 | ||
| 14 | static HSV SOLID_REACTIVE_NEXUS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | 14 | static HSV SOLID_REACTIVE_NEXUS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { |
| 15 | uint16_t effect = tick - dist; | 15 | uint16_t effect = tick - dist; |
| 16 | if (effect > 255) | 16 | if (effect > 255) effect = 255; |
| 17 | effect = 255; | 17 | if (dist > 72) effect = 255; |
| 18 | if (dist > 72) | 18 | if ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) effect = 255; |
| 19 | effect = 255; | ||
| 20 | if ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) | ||
| 21 | effect = 255; | ||
| 22 | hsv.v = qadd8(hsv.v, 255 - effect); | 19 | hsv.v = qadd8(hsv.v, 255 - effect); |
| 23 | hsv.h = rgb_matrix_config.hsv.h + dy / 4; | 20 | hsv.h = rgb_matrix_config.hsv.h + dy / 4; |
| 24 | return hsv; | 21 | return hsv; |
| 25 | } | 22 | } |
| 26 | 23 | ||
| 27 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS | 24 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS |
| 28 | bool SOLID_REACTIVE_NEXUS(effect_params_t* params) { | 25 | bool SOLID_REACTIVE_NEXUS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math); } |
| 29 | return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math); | 26 | # endif |
| 30 | } | ||
| 31 | #endif | ||
| 32 | 27 | ||
| 33 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS | 28 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS |
| 34 | bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { | 29 | bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); } |
| 35 | return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); | 30 | # endif |
| 36 | } | ||
| 37 | #endif | ||
| 38 | 31 | ||
| 39 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 32 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 40 | #endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) | 33 | # endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) |
| 41 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED | 34 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED |
diff --git a/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h b/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h index 77c8ff672..12eb248cc 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h +++ b/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h | |||
| @@ -1,17 +1,15 @@ | |||
| 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 2 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE | 2 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE |
| 3 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE) | 3 | 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 SOLID_REACTIVE_SIMPLE_math(HSV hsv, uint16_t offset) { | 6 | static HSV SOLID_REACTIVE_SIMPLE_math(HSV hsv, uint16_t offset) { |
| 7 | hsv.v = scale8(255 - offset, hsv.v); | 7 | hsv.v = scale8(255 - offset, hsv.v); |
| 8 | return hsv; | 8 | return hsv; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { | 11 | bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math); } |
| 12 | return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math); | ||
| 13 | } | ||
| 14 | 12 | ||
| 15 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 13 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 16 | #endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE | 14 | # endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE |
| 17 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED | 15 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED |
diff --git a/quantum/rgb_matrix_animations/solid_reactive_wide.h b/quantum/rgb_matrix_animations/solid_reactive_wide.h index 73779dfa7..1cc4dca72 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_wide.h +++ b/quantum/rgb_matrix_animations/solid_reactive_wide.h | |||
| @@ -1,36 +1,31 @@ | |||
| 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 2 | #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) | 2 | # if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) |
| 3 | 3 | ||
| 4 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE | 4 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE |
| 5 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_WIDE) | 5 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_WIDE) |
| 6 | #endif | 6 | # endif |
| 7 | 7 | ||
| 8 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE | 8 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE |
| 9 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE) | 9 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE) |
| 10 | #endif | 10 | # endif |
| 11 | 11 | ||
| 12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 13 | 13 | ||
| 14 | static HSV SOLID_REACTIVE_WIDE_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | 14 | static HSV SOLID_REACTIVE_WIDE_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { |
| 15 | uint16_t effect = tick + dist * 5; | 15 | uint16_t effect = tick + dist * 5; |
| 16 | if (effect > 255) | 16 | if (effect > 255) effect = 255; |
| 17 | effect = 255; | ||
| 18 | hsv.v = qadd8(hsv.v, 255 - effect); | 17 | hsv.v = qadd8(hsv.v, 255 - effect); |
| 19 | return hsv; | 18 | return hsv; |
| 20 | } | 19 | } |
| 21 | 20 | ||
| 22 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE | 21 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE |
| 23 | bool SOLID_REACTIVE_WIDE(effect_params_t* params) { | 22 | bool SOLID_REACTIVE_WIDE(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math); } |
| 24 | return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math); | 23 | # endif |
| 25 | } | ||
| 26 | #endif | ||
| 27 | 24 | ||
| 28 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE | 25 | # ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE |
| 29 | bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { | 26 | bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); } |
| 30 | return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); | 27 | # endif |
| 31 | } | ||
| 32 | #endif | ||
| 33 | 28 | ||
| 34 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 29 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 35 | #endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) | 30 | # endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) |
| 36 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED | 31 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED |
diff --git a/quantum/rgb_matrix_animations/solid_splash_anim.h b/quantum/rgb_matrix_animations/solid_splash_anim.h index 441f35576..99efb4996 100644 --- a/quantum/rgb_matrix_animations/solid_splash_anim.h +++ b/quantum/rgb_matrix_animations/solid_splash_anim.h | |||
| @@ -1,36 +1,31 @@ | |||
| 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 2 | #if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH) | 2 | # if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH) |
| 3 | 3 | ||
| 4 | #ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH | 4 | # ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH |
| 5 | RGB_MATRIX_EFFECT(SOLID_SPLASH) | 5 | RGB_MATRIX_EFFECT(SOLID_SPLASH) |
| 6 | #endif | 6 | # endif |
| 7 | 7 | ||
| 8 | #ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH | 8 | # ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH |
| 9 | RGB_MATRIX_EFFECT(SOLID_MULTISPLASH) | 9 | RGB_MATRIX_EFFECT(SOLID_MULTISPLASH) |
| 10 | #endif | 10 | # endif |
| 11 | 11 | ||
| 12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 13 | 13 | ||
| 14 | HSV SOLID_SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | 14 | HSV SOLID_SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { |
| 15 | uint16_t effect = tick - dist; | 15 | uint16_t effect = tick - dist; |
| 16 | if (effect > 255) | 16 | if (effect > 255) effect = 255; |
| 17 | effect = 255; | ||
| 18 | hsv.v = qadd8(hsv.v, 255 - effect); | 17 | hsv.v = qadd8(hsv.v, 255 - effect); |
| 19 | return hsv; | 18 | return hsv; |
| 20 | } | 19 | } |
| 21 | 20 | ||
| 22 | #ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH | 21 | # ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH |
| 23 | bool SOLID_SPLASH(effect_params_t* params) { | 22 | bool SOLID_SPLASH(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); } |
| 24 | return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); | 23 | # endif |
| 25 | } | ||
| 26 | #endif | ||
| 27 | 24 | ||
| 28 | #ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH | 25 | # ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH |
| 29 | bool SOLID_MULTISPLASH(effect_params_t* params) { | 26 | bool SOLID_MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); } |
| 30 | return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); | 27 | # endif |
| 31 | } | ||
| 32 | #endif | ||
| 33 | 28 | ||
| 34 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 29 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 35 | #endif // !defined(DISABLE_RGB_MATRIX_SPLASH) && !defined(DISABLE_RGB_MATRIX_MULTISPLASH) | 30 | # endif // !defined(DISABLE_RGB_MATRIX_SPLASH) && !defined(DISABLE_RGB_MATRIX_MULTISPLASH) |
| 36 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED | 31 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED |
diff --git a/quantum/rgb_matrix_animations/splash_anim.h b/quantum/rgb_matrix_animations/splash_anim.h index 19ccb256e..1415bcc0f 100644 --- a/quantum/rgb_matrix_animations/splash_anim.h +++ b/quantum/rgb_matrix_animations/splash_anim.h | |||
| @@ -1,37 +1,32 @@ | |||
| 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 1 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 2 | #if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH) | 2 | # if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH) |
| 3 | 3 | ||
| 4 | #ifndef DISABLE_RGB_MATRIX_SPLASH | 4 | # ifndef DISABLE_RGB_MATRIX_SPLASH |
| 5 | RGB_MATRIX_EFFECT(SPLASH) | 5 | RGB_MATRIX_EFFECT(SPLASH) |
| 6 | #endif | 6 | # endif |
| 7 | 7 | ||
| 8 | #ifndef DISABLE_RGB_MATRIX_MULTISPLASH | 8 | # ifndef DISABLE_RGB_MATRIX_MULTISPLASH |
| 9 | RGB_MATRIX_EFFECT(MULTISPLASH) | 9 | RGB_MATRIX_EFFECT(MULTISPLASH) |
| 10 | #endif | 10 | # endif |
| 11 | 11 | ||
| 12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 13 | 13 | ||
| 14 | HSV SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | 14 | HSV SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { |
| 15 | uint16_t effect = tick - dist; | 15 | uint16_t effect = tick - dist; |
| 16 | if (effect > 255) | 16 | if (effect > 255) effect = 255; |
| 17 | effect = 255; | ||
| 18 | hsv.h += effect; | 17 | hsv.h += effect; |
| 19 | hsv.v = qadd8(hsv.v, 255 - effect); | 18 | hsv.v = qadd8(hsv.v, 255 - effect); |
| 20 | return hsv; | 19 | return hsv; |
| 21 | } | 20 | } |
| 22 | 21 | ||
| 23 | #ifndef DISABLE_RGB_MATRIX_SPLASH | 22 | # ifndef DISABLE_RGB_MATRIX_SPLASH |
| 24 | bool SPLASH(effect_params_t* params) { | 23 | bool SPLASH(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SPLASH_math); } |
| 25 | return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SPLASH_math); | 24 | # endif |
| 26 | } | ||
| 27 | #endif | ||
| 28 | 25 | ||
| 29 | #ifndef DISABLE_RGB_MATRIX_MULTISPLASH | 26 | # ifndef DISABLE_RGB_MATRIX_MULTISPLASH |
| 30 | bool MULTISPLASH(effect_params_t* params) { | 27 | bool MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SPLASH_math); } |
| 31 | return effect_runner_reactive_splash(0, params, &SPLASH_math); | 28 | # endif |
| 32 | } | ||
| 33 | #endif | ||
| 34 | 29 | ||
| 35 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 30 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 36 | #endif // !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH) | 31 | # endif // !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH) |
| 37 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED | 32 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED |
diff --git a/quantum/rgb_matrix_animations/typing_heatmap_anim.h b/quantum/rgb_matrix_animations/typing_heatmap_anim.h index 374b7fea0..dd313f16a 100644 --- a/quantum/rgb_matrix_animations/typing_heatmap_anim.h +++ b/quantum/rgb_matrix_animations/typing_heatmap_anim.h | |||
| @@ -1,74 +1,65 @@ | |||
| 1 | #if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) | 1 | #if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) |
| 2 | RGB_MATRIX_EFFECT(TYPING_HEATMAP) | 2 | RGB_MATRIX_EFFECT(TYPING_HEATMAP) |
| 3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | void process_rgb_matrix_typing_heatmap(keyrecord_t *record) { | 5 | void process_rgb_matrix_typing_heatmap(keyrecord_t* record) { |
| 6 | uint8_t row = record->event.key.row; | 6 | uint8_t row = record->event.key.row; |
| 7 | uint8_t col = record->event.key.col; | 7 | uint8_t col = record->event.key.col; |
| 8 | uint8_t m_row = row - 1; | 8 | uint8_t m_row = row - 1; |
| 9 | uint8_t p_row = row + 1; | 9 | uint8_t p_row = row + 1; |
| 10 | uint8_t m_col = col - 1; | 10 | uint8_t m_col = col - 1; |
| 11 | uint8_t p_col = col + 1; | 11 | uint8_t p_col = col + 1; |
| 12 | 12 | ||
| 13 | if (m_col < col) | 13 | if (m_col < col) rgb_frame_buffer[row][m_col] = qadd8(rgb_frame_buffer[row][m_col], 16); |
| 14 | rgb_frame_buffer[row][m_col] = qadd8(rgb_frame_buffer[row][m_col], 16); | ||
| 15 | rgb_frame_buffer[row][col] = qadd8(rgb_frame_buffer[row][col], 32); | 14 | rgb_frame_buffer[row][col] = qadd8(rgb_frame_buffer[row][col], 32); |
| 16 | if (p_col < MATRIX_COLS) | 15 | if (p_col < MATRIX_COLS) rgb_frame_buffer[row][p_col] = qadd8(rgb_frame_buffer[row][p_col], 16); |
| 17 | rgb_frame_buffer[row][p_col] = qadd8(rgb_frame_buffer[row][p_col], 16); | ||
| 18 | 16 | ||
| 19 | if (p_row < MATRIX_ROWS) { | 17 | if (p_row < MATRIX_ROWS) { |
| 20 | if (m_col < col) | 18 | if (m_col < col) rgb_frame_buffer[p_row][m_col] = qadd8(rgb_frame_buffer[p_row][m_col], 13); |
| 21 | rgb_frame_buffer[p_row][m_col] = qadd8(rgb_frame_buffer[p_row][m_col], 13); | 19 | rgb_frame_buffer[p_row][col] = qadd8(rgb_frame_buffer[p_row][col], 16); |
| 22 | rgb_frame_buffer[p_row][col] = qadd8(rgb_frame_buffer[p_row][col], 16); | 20 | if (p_col < MATRIX_COLS) rgb_frame_buffer[p_row][p_col] = qadd8(rgb_frame_buffer[p_row][p_col], 13); |
| 23 | if (p_col < MATRIX_COLS) | ||
| 24 | rgb_frame_buffer[p_row][p_col] = qadd8(rgb_frame_buffer[p_row][p_col], 13); | ||
| 25 | } | 21 | } |
| 26 | 22 | ||
| 27 | if (m_row < row) { | 23 | if (m_row < row) { |
| 28 | if (m_col < col) | 24 | if (m_col < col) rgb_frame_buffer[m_row][m_col] = qadd8(rgb_frame_buffer[m_row][m_col], 13); |
| 29 | rgb_frame_buffer[m_row][m_col] = qadd8(rgb_frame_buffer[m_row][m_col], 13); | 25 | rgb_frame_buffer[m_row][col] = qadd8(rgb_frame_buffer[m_row][col], 16); |
| 30 | rgb_frame_buffer[m_row][col] = qadd8(rgb_frame_buffer[m_row][col], 16); | 26 | if (p_col < MATRIX_COLS) rgb_frame_buffer[m_row][p_col] = qadd8(rgb_frame_buffer[m_row][p_col], 13); |
| 31 | if (p_col < MATRIX_COLS) | ||
| 32 | rgb_frame_buffer[m_row][p_col] = qadd8(rgb_frame_buffer[m_row][p_col], 13); | ||
| 33 | } | 27 | } |
| 34 | } | 28 | } |
| 35 | 29 | ||
| 36 | bool TYPING_HEATMAP(effect_params_t* params) { | 30 | bool TYPING_HEATMAP(effect_params_t* params) { |
| 37 | // Modified version of RGB_MATRIX_USE_LIMITS to work off of matrix row / col size | 31 | // Modified version of RGB_MATRIX_USE_LIMITS to work off of matrix row / col size |
| 38 | uint8_t led_min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; | 32 | uint8_t led_min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; |
| 39 | uint8_t led_max = led_min + RGB_MATRIX_LED_PROCESS_LIMIT; | 33 | uint8_t led_max = led_min + RGB_MATRIX_LED_PROCESS_LIMIT; |
| 40 | if (led_max > sizeof(rgb_frame_buffer)) | 34 | if (led_max > sizeof(rgb_frame_buffer)) led_max = sizeof(rgb_frame_buffer); |
| 41 | led_max = sizeof(rgb_frame_buffer); | ||
| 42 | 35 | ||
| 43 | if (params->init) { | 36 | if (params->init) { |
| 44 | rgb_matrix_set_color_all(0, 0, 0); | 37 | rgb_matrix_set_color_all(0, 0, 0); |
| 45 | memset(rgb_frame_buffer, 0, sizeof rgb_frame_buffer); | 38 | memset(rgb_frame_buffer, 0, sizeof rgb_frame_buffer); |
| 46 | } | 39 | } |
| 47 | 40 | ||
| 48 | // Render heatmap & decrease | 41 | // Render heatmap & decrease |
| 49 | for (int i = led_min; i < led_max; i++) { | 42 | for (int i = led_min; i < led_max; i++) { |
| 50 | uint8_t row = i % MATRIX_ROWS; | 43 | uint8_t row = i % MATRIX_ROWS; |
| 51 | uint8_t col = i / MATRIX_ROWS; | 44 | uint8_t col = i / MATRIX_ROWS; |
| 52 | uint8_t val = rgb_frame_buffer[row][col]; | 45 | uint8_t val = rgb_frame_buffer[row][col]; |
| 53 | 46 | ||
| 54 | // set the pixel colour | 47 | // set the pixel colour |
| 55 | uint8_t led[LED_HITS_TO_REMEMBER]; | 48 | uint8_t led[LED_HITS_TO_REMEMBER]; |
| 56 | uint8_t led_count = rgb_matrix_map_row_column_to_led(row, col, led); | 49 | uint8_t led_count = rgb_matrix_map_row_column_to_led(row, col, led); |
| 57 | for (uint8_t j = 0; j < led_count; ++j) | 50 | for (uint8_t j = 0; j < led_count; ++j) { |
| 58 | { | 51 | if (!HAS_ANY_FLAGS(g_led_config.flags[led[j]], params->flags)) continue; |
| 59 | if (!HAS_ANY_FLAGS(g_led_config.flags[led[j]], params->flags)) | ||
| 60 | continue; | ||
| 61 | 52 | ||
| 62 | HSV hsv = { 170 - qsub8(val, 85), rgb_matrix_config.hsv.s, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.hsv.v) }; | 53 | HSV hsv = {170 - qsub8(val, 85), rgb_matrix_config.hsv.s, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.hsv.v)}; |
| 63 | RGB rgb = hsv_to_rgb(hsv); | 54 | RGB rgb = hsv_to_rgb(hsv); |
| 64 | rgb_matrix_set_color(led[j], rgb.r, rgb.g, rgb.b); | 55 | rgb_matrix_set_color(led[j], rgb.r, rgb.g, rgb.b); |
| 65 | } | 56 | } |
| 66 | 57 | ||
| 67 | rgb_frame_buffer[row][col] = qsub8(val, 1); | 58 | rgb_frame_buffer[row][col] = qsub8(val, 1); |
| 68 | } | 59 | } |
| 69 | 60 | ||
| 70 | return led_max < sizeof(rgb_frame_buffer); | 61 | return led_max < sizeof(rgb_frame_buffer); |
| 71 | } | 62 | } |
| 72 | 63 | ||
| 73 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 64 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 74 | #endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) | 65 | #endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) |
