diff options
| author | XScorpion2 <rcalt2vt@gmail.com> | 2019-05-07 18:22:46 -0500 |
|---|---|---|
| committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-05-07 16:22:46 -0700 |
| commit | af89752bffbaf5dcea30ea16be66b4d682701bc4 (patch) | |
| tree | c82f2bc25409159a44778379db8b3a35afc47b8a /quantum/rgb_matrix_animations | |
| parent | c7f8548d9af2045996294602d2a4bd9a214ae23c (diff) | |
| download | qmk_firmware-af89752bffbaf5dcea30ea16be66b4d682701bc4.tar.gz qmk_firmware-af89752bffbaf5dcea30ea16be66b4d682701bc4.zip | |
rgb_led struct conversion (aka: Per led (key) type rgb matrix effects - part 2) (#5783)
* Initial conversion of the rgb_led struct
* Converting last keyboard & updating effects to take advantage of the new structure
* New struct should not be const
* Updated docs
* Changing define ___ for no led to NO_LED
* Missed converting some keymap usages of the old struct layout
Diffstat (limited to 'quantum/rgb_matrix_animations')
19 files changed, 39 insertions, 47 deletions
diff --git a/quantum/rgb_matrix_animations/alpha_mods_anim.h b/quantum/rgb_matrix_animations/alpha_mods_anim.h index 4bd01c4fc..d7f6f4655 100644 --- a/quantum/rgb_matrix_animations/alpha_mods_anim.h +++ b/quantum/rgb_matrix_animations/alpha_mods_anim.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | #ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS | 2 | #ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS |
| 3 | 3 | ||
| 4 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 4 | extern led_config_t g_led_config; |
| 5 | extern rgb_config_t rgb_matrix_config; | 5 | extern rgb_config_t rgb_matrix_config; |
| 6 | 6 | ||
| 7 | // alphas = color1, mods = color2 | 7 | // alphas = color1, mods = color2 |
| @@ -15,7 +15,7 @@ bool rgb_matrix_alphas_mods(effect_params_t* params) { | |||
| 15 | 15 | ||
| 16 | for (uint8_t i = led_min; i < led_max; i++) { | 16 | for (uint8_t i = led_min; i < led_max; i++) { |
| 17 | RGB_MATRIX_TEST_LED_FLAGS(); | 17 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 18 | if (HAS_FLAGS(g_rgb_leds[i].flags, LED_FLAG_MODIFIER)) { | 18 | if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { |
| 19 | rgb_matrix_set_color(i, rgb2.r, rgb2.g, rgb2.b); | 19 | rgb_matrix_set_color(i, rgb2.r, rgb2.g, rgb2.b); |
| 20 | } else { | 20 | } else { |
| 21 | rgb_matrix_set_color(i, rgb1.r, rgb1.g, rgb1.b); | 21 | rgb_matrix_set_color(i, rgb1.r, rgb1.g, rgb1.b); |
diff --git a/quantum/rgb_matrix_animations/cycle_all_anim.h b/quantum/rgb_matrix_animations/cycle_all_anim.h index 513dff128..e93798f90 100644 --- a/quantum/rgb_matrix_animations/cycle_all_anim.h +++ b/quantum/rgb_matrix_animations/cycle_all_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifndef DISABLE_RGB_MATRIX_CYCLE_ALL | 2 | #ifndef DISABLE_RGB_MATRIX_CYCLE_ALL |
| 3 | 3 | ||
| 4 | extern rgb_counters_t g_rgb_counters; | 4 | extern rgb_counters_t g_rgb_counters; |
| 5 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 5 | extern led_config_t g_led_config; |
| 6 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 7 | 7 | ||
| 8 | bool rgb_matrix_cycle_all(effect_params_t* params) { | 8 | bool rgb_matrix_cycle_all(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/cycle_left_right_anim.h b/quantum/rgb_matrix_animations/cycle_left_right_anim.h index 428adea22..4b09d5826 100644 --- a/quantum/rgb_matrix_animations/cycle_left_right_anim.h +++ b/quantum/rgb_matrix_animations/cycle_left_right_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT | 2 | #ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT |
| 3 | 3 | ||
| 4 | extern rgb_counters_t g_rgb_counters; | 4 | extern rgb_counters_t g_rgb_counters; |
| 5 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 5 | extern led_config_t g_led_config; |
| 6 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 7 | 7 | ||
| 8 | bool rgb_matrix_cycle_left_right(effect_params_t* params) { | 8 | bool rgb_matrix_cycle_left_right(effect_params_t* params) { |
| @@ -12,8 +12,7 @@ bool rgb_matrix_cycle_left_right(effect_params_t* params) { | |||
| 12 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); | 12 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); |
| 13 | for (uint8_t i = led_min; i < led_max; i++) { | 13 | for (uint8_t i = led_min; i < led_max; i++) { |
| 14 | RGB_MATRIX_TEST_LED_FLAGS(); | 14 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 15 | point_t point = g_rgb_leds[i].point; | 15 | hsv.h = g_led_config.point[i].x - time; |
| 16 | hsv.h = point.x - time; | ||
| 17 | RGB rgb = hsv_to_rgb(hsv); | 16 | RGB rgb = hsv_to_rgb(hsv); |
| 18 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 17 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 19 | } | 18 | } |
diff --git a/quantum/rgb_matrix_animations/cycle_up_down_anim.h b/quantum/rgb_matrix_animations/cycle_up_down_anim.h index ea63095d2..403214bb7 100644 --- a/quantum/rgb_matrix_animations/cycle_up_down_anim.h +++ b/quantum/rgb_matrix_animations/cycle_up_down_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN | 2 | #ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN |
| 3 | 3 | ||
| 4 | extern rgb_counters_t g_rgb_counters; | 4 | extern rgb_counters_t g_rgb_counters; |
| 5 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 5 | extern led_config_t g_led_config; |
| 6 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 7 | 7 | ||
| 8 | bool rgb_matrix_cycle_up_down(effect_params_t* params) { | 8 | bool rgb_matrix_cycle_up_down(effect_params_t* params) { |
| @@ -12,8 +12,7 @@ bool rgb_matrix_cycle_up_down(effect_params_t* params) { | |||
| 12 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); | 12 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); |
| 13 | for (uint8_t i = led_min; i < led_max; i++) { | 13 | for (uint8_t i = led_min; i < led_max; i++) { |
| 14 | RGB_MATRIX_TEST_LED_FLAGS(); | 14 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 15 | point_t point = g_rgb_leds[i].point; | 15 | hsv.h = g_led_config.point[i].y - time; |
| 16 | hsv.h = point.y - time; | ||
| 17 | RGB rgb = hsv_to_rgb(hsv); | 16 | RGB rgb = hsv_to_rgb(hsv); |
| 18 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 17 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 19 | } | 18 | } |
diff --git a/quantum/rgb_matrix_animations/dual_beacon_anim.h b/quantum/rgb_matrix_animations/dual_beacon_anim.h index 00f6e5088..dcb594029 100644 --- a/quantum/rgb_matrix_animations/dual_beacon_anim.h +++ b/quantum/rgb_matrix_animations/dual_beacon_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifndef DISABLE_RGB_MATRIX_DUAL_BEACON | 2 | #ifndef DISABLE_RGB_MATRIX_DUAL_BEACON |
| 3 | 3 | ||
| 4 | extern rgb_counters_t g_rgb_counters; | 4 | extern rgb_counters_t g_rgb_counters; |
| 5 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 5 | extern led_config_t g_led_config; |
| 6 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 7 | 7 | ||
| 8 | bool rgb_matrix_dual_beacon(effect_params_t* params) { | 8 | bool rgb_matrix_dual_beacon(effect_params_t* params) { |
| @@ -14,8 +14,7 @@ bool rgb_matrix_dual_beacon(effect_params_t* params) { | |||
| 14 | int8_t sin_value = sin8(time) - 128; | 14 | int8_t sin_value = sin8(time) - 128; |
| 15 | for (uint8_t i = led_min; i < led_max; i++) { | 15 | for (uint8_t i = led_min; i < led_max; i++) { |
| 16 | RGB_MATRIX_TEST_LED_FLAGS(); | 16 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 17 | point_t point = g_rgb_leds[i].point; | 17 | hsv.h = ((g_led_config.point[i].y - 32) * cos_value + (g_led_config.point[i].x - 112) * sin_value) / 128 + rgb_matrix_config.hue; |
| 18 | hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue; | ||
| 19 | RGB rgb = hsv_to_rgb(hsv); | 18 | RGB rgb = hsv_to_rgb(hsv); |
| 20 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 19 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 21 | } | 20 | } |
diff --git a/quantum/rgb_matrix_animations/gradient_up_down_anim.h b/quantum/rgb_matrix_animations/gradient_up_down_anim.h index 05117540a..7a6ed1421 100644 --- a/quantum/rgb_matrix_animations/gradient_up_down_anim.h +++ b/quantum/rgb_matrix_animations/gradient_up_down_anim.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | #ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN | 2 | #ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN |
| 3 | 3 | ||
| 4 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 4 | extern led_config_t g_led_config; |
| 5 | extern rgb_config_t rgb_matrix_config; | 5 | extern rgb_config_t rgb_matrix_config; |
| 6 | 6 | ||
| 7 | bool rgb_matrix_gradient_up_down(effect_params_t* params) { | 7 | bool rgb_matrix_gradient_up_down(effect_params_t* params) { |
| @@ -11,10 +11,9 @@ bool rgb_matrix_gradient_up_down(effect_params_t* params) { | |||
| 11 | uint8_t scale = scale8(64, rgb_matrix_config.speed); | 11 | uint8_t scale = scale8(64, rgb_matrix_config.speed); |
| 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 | point_t point = g_rgb_leds[i].point; | ||
| 15 | // The y range will be 0..64, map this to 0..4 | 14 | // The y range will be 0..64, map this to 0..4 |
| 16 | // Relies on hue being 8-bit and wrapping | 15 | // Relies on hue being 8-bit and wrapping |
| 17 | hsv.h = rgb_matrix_config.hue + scale * (point.y >> 4); | 16 | hsv.h = rgb_matrix_config.hue + scale * (g_led_config.point[i].y >> 4); |
| 18 | RGB rgb = hsv_to_rgb(hsv); | 17 | RGB rgb = hsv_to_rgb(hsv); |
| 19 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 18 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 20 | } | 19 | } |
diff --git a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h index dffa53264..5ea971435 100644 --- a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h +++ b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h | |||
| @@ -2,11 +2,11 @@ | |||
| 2 | #ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS | 2 | #ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS |
| 3 | 3 | ||
| 4 | extern rgb_counters_t g_rgb_counters; | 4 | extern rgb_counters_t g_rgb_counters; |
| 5 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 5 | extern led_config_t g_led_config; |
| 6 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 7 | 7 | ||
| 8 | static void jellybean_raindrops_set_color(int i, effect_params_t* params) { | 8 | static void jellybean_raindrops_set_color(int i, effect_params_t* params) { |
| 9 | if (!HAS_ANY_FLAGS(g_rgb_leds[i].flags, params->flags)) return; | 9 | if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; |
| 10 | HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.val }; | 10 | HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.val }; |
| 11 | RGB rgb = hsv_to_rgb(hsv); | 11 | RGB rgb = hsv_to_rgb(hsv); |
| 12 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 12 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
diff --git a/quantum/rgb_matrix_animations/rainbow_beacon_anim.h b/quantum/rgb_matrix_animations/rainbow_beacon_anim.h index 89f6965c3..d46288073 100644 --- a/quantum/rgb_matrix_animations/rainbow_beacon_anim.h +++ b/quantum/rgb_matrix_animations/rainbow_beacon_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON | 2 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON |
| 3 | 3 | ||
| 4 | extern rgb_counters_t g_rgb_counters; | 4 | extern rgb_counters_t g_rgb_counters; |
| 5 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 5 | extern led_config_t g_led_config; |
| 6 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 7 | 7 | ||
| 8 | bool rgb_matrix_rainbow_beacon(effect_params_t* params) { | 8 | bool rgb_matrix_rainbow_beacon(effect_params_t* params) { |
| @@ -14,8 +14,7 @@ bool rgb_matrix_rainbow_beacon(effect_params_t* params) { | |||
| 14 | int16_t sin_value = 2 * (sin8(time) - 128); | 14 | int16_t sin_value = 2 * (sin8(time) - 128); |
| 15 | for (uint8_t i = led_min; i < led_max; i++) { | 15 | for (uint8_t i = led_min; i < led_max; i++) { |
| 16 | RGB_MATRIX_TEST_LED_FLAGS(); | 16 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 17 | point_t point = g_rgb_leds[i].point; | 17 | hsv.h = ((g_led_config.point[i].y - 32) * cos_value + (g_led_config.point[i].x - 112) * sin_value) / 128 + rgb_matrix_config.hue; |
| 18 | hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue; | ||
| 19 | RGB rgb = hsv_to_rgb(hsv); | 18 | RGB rgb = hsv_to_rgb(hsv); |
| 20 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 19 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 21 | } | 20 | } |
diff --git a/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h b/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h index 0d57aef57..3b7d9689f 100644 --- a/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h +++ b/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON | 2 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON |
| 3 | 3 | ||
| 4 | extern rgb_counters_t g_rgb_counters; | 4 | extern rgb_counters_t g_rgb_counters; |
| 5 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 5 | extern led_config_t g_led_config; |
| 6 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 7 | 7 | ||
| 8 | bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) { | 8 | bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) { |
| @@ -12,8 +12,7 @@ bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) { | |||
| 12 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); | 12 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); |
| 13 | for (uint8_t i = led_min; i < led_max; i++) { | 13 | for (uint8_t i = led_min; i < led_max; i++) { |
| 14 | RGB_MATRIX_TEST_LED_FLAGS(); | 14 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 15 | point_t point = g_rgb_leds[i].point; | 15 | hsv.h = abs8(g_led_config.point[i].y - 32) + (g_led_config.point[i].x - time) + rgb_matrix_config.hue; |
| 16 | hsv.h = abs8(point.y - 32) + (point.x - time) + rgb_matrix_config.hue; | ||
| 17 | RGB rgb = hsv_to_rgb(hsv); | 16 | RGB rgb = hsv_to_rgb(hsv); |
| 18 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 17 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 19 | } | 18 | } |
diff --git a/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h b/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h index 03652758c..e92f35176 100644 --- a/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h +++ b/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS | 2 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS |
| 3 | 3 | ||
| 4 | extern rgb_counters_t g_rgb_counters; | 4 | extern rgb_counters_t g_rgb_counters; |
| 5 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 5 | extern led_config_t g_led_config; |
| 6 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 7 | 7 | ||
| 8 | bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) { | 8 | bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) { |
| @@ -14,8 +14,7 @@ bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) { | |||
| 14 | int16_t sin_value = 3 * (sin8(time) - 128); | 14 | int16_t sin_value = 3 * (sin8(time) - 128); |
| 15 | for (uint8_t i = led_min; i < led_max; i++) { | 15 | for (uint8_t i = led_min; i < led_max; i++) { |
| 16 | RGB_MATRIX_TEST_LED_FLAGS(); | 16 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 17 | point_t point = g_rgb_leds[i].point; | 17 | hsv.h = ((g_led_config.point[i].y - 32) * cos_value + (56 - abs8(g_led_config.point[i].x - 112)) * sin_value) / 128 + rgb_matrix_config.hue; |
| 18 | hsv.h = ((point.y - 32) * cos_value + (56 - abs8(point.x - 112)) * sin_value) / 128 + rgb_matrix_config.hue; | ||
| 19 | RGB rgb = hsv_to_rgb(hsv); | 18 | RGB rgb = hsv_to_rgb(hsv); |
| 20 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 19 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 21 | } | 20 | } |
diff --git a/quantum/rgb_matrix_animations/raindrops_anim.h b/quantum/rgb_matrix_animations/raindrops_anim.h index 0e3a87864..4ce1d65e5 100644 --- a/quantum/rgb_matrix_animations/raindrops_anim.h +++ b/quantum/rgb_matrix_animations/raindrops_anim.h | |||
| @@ -3,10 +3,11 @@ | |||
| 3 | #include "rgb_matrix_types.h" | 3 | #include "rgb_matrix_types.h" |
| 4 | 4 | ||
| 5 | extern rgb_counters_t g_rgb_counters; | 5 | extern rgb_counters_t g_rgb_counters; |
| 6 | extern led_config_t g_led_config; | ||
| 6 | extern rgb_config_t rgb_matrix_config; | 7 | extern rgb_config_t rgb_matrix_config; |
| 7 | 8 | ||
| 8 | static void raindrops_set_color(int i, effect_params_t* params) { | 9 | static void raindrops_set_color(int i, effect_params_t* params) { |
| 9 | if (!HAS_ANY_FLAGS(g_rgb_leds[i].flags, params->flags)) return; | 10 | if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; |
| 10 | HSV hsv = { 0 , rgb_matrix_config.sat, rgb_matrix_config.val }; | 11 | HSV hsv = { 0 , rgb_matrix_config.sat, rgb_matrix_config.val }; |
| 11 | 12 | ||
| 12 | // Take the shortest path between hues | 13 | // Take the shortest path between hues |
diff --git a/quantum/rgb_matrix_animations/solid_color_anim.h b/quantum/rgb_matrix_animations/solid_color_anim.h index 033c1f933..ba2cea15e 100644 --- a/quantum/rgb_matrix_animations/solid_color_anim.h +++ b/quantum/rgb_matrix_animations/solid_color_anim.h | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | 2 | ||
| 3 | extern led_config_t g_led_config; | ||
| 3 | extern rgb_config_t rgb_matrix_config; | 4 | extern rgb_config_t rgb_matrix_config; |
| 4 | 5 | ||
| 5 | bool rgb_matrix_solid_color(effect_params_t* params) { | 6 | bool rgb_matrix_solid_color(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/solid_reactive_anim.h b/quantum/rgb_matrix_animations/solid_reactive_anim.h index 82483653a..c3dba8a5a 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_anim.h +++ b/quantum/rgb_matrix_animations/solid_reactive_anim.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) | 2 | #if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) |
| 3 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE | 3 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE |
| 4 | 4 | ||
| 5 | extern led_config_t g_led_config; | ||
| 5 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 6 | extern last_hit_t g_last_hit_tracker; | 7 | extern last_hit_t g_last_hit_tracker; |
| 7 | 8 | ||
diff --git a/quantum/rgb_matrix_animations/solid_reactive_cross.h b/quantum/rgb_matrix_animations/solid_reactive_cross.h index 1dec1886d..8858f71e6 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_cross.h +++ b/quantum/rgb_matrix_animations/solid_reactive_cross.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 2 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 3 | #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) | 3 | #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) |
| 4 | 4 | ||
| 5 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 5 | extern led_config_t g_led_config; |
| 6 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 7 | extern last_hit_t g_last_hit_tracker; | 7 | extern last_hit_t g_last_hit_tracker; |
| 8 | 8 | ||
| @@ -13,11 +13,10 @@ static bool rgb_matrix_solid_reactive_multicross_range(uint8_t start, effect_par | |||
| 13 | uint8_t count = g_last_hit_tracker.count; | 13 | uint8_t count = g_last_hit_tracker.count; |
| 14 | for (uint8_t i = led_min; i < led_max; i++) { | 14 | for (uint8_t i = led_min; i < led_max; i++) { |
| 15 | hsv.v = 0; | 15 | hsv.v = 0; |
| 16 | point_t point = g_rgb_leds[i].point; | ||
| 17 | for (uint8_t j = start; j < count; j++) { | 16 | for (uint8_t j = start; j < count; j++) { |
| 18 | RGB_MATRIX_TEST_LED_FLAGS(); | 17 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 19 | int16_t dx = point.x - g_last_hit_tracker.x[j]; | 18 | int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; |
| 20 | int16_t dy = point.y - g_last_hit_tracker.y[j]; | 19 | int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; |
| 21 | uint8_t dist = sqrt16(dx * dx + dy * dy); | 20 | uint8_t dist = sqrt16(dx * dx + dy * dy); |
| 22 | int16_t dist2 = 16; | 21 | int16_t dist2 = 16; |
| 23 | uint8_t dist3; | 22 | uint8_t dist3; |
diff --git a/quantum/rgb_matrix_animations/solid_reactive_nexus.h b/quantum/rgb_matrix_animations/solid_reactive_nexus.h index 8952a1e2b..c0e3c2450 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_nexus.h +++ b/quantum/rgb_matrix_animations/solid_reactive_nexus.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 2 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 3 | #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) | 3 | #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) |
| 4 | 4 | ||
| 5 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 5 | extern led_config_t g_led_config; |
| 6 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 7 | extern last_hit_t g_last_hit_tracker; | 7 | extern last_hit_t g_last_hit_tracker; |
| 8 | 8 | ||
| @@ -13,11 +13,10 @@ static bool rgb_matrix_solid_reactive_multinexus_range(uint8_t start, effect_par | |||
| 13 | uint8_t count = g_last_hit_tracker.count; | 13 | uint8_t count = g_last_hit_tracker.count; |
| 14 | for (uint8_t i = led_min; i < led_max; i++) { | 14 | for (uint8_t i = led_min; i < led_max; i++) { |
| 15 | hsv.v = 0; | 15 | hsv.v = 0; |
| 16 | point_t point = g_rgb_leds[i].point; | ||
| 17 | for (uint8_t j = start; j < count; j++) { | 16 | for (uint8_t j = start; j < count; j++) { |
| 18 | RGB_MATRIX_TEST_LED_FLAGS(); | 17 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 19 | int16_t dx = point.x - g_last_hit_tracker.x[j]; | 18 | int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; |
| 20 | int16_t dy = point.y - g_last_hit_tracker.y[j]; | 19 | int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; |
| 21 | uint8_t dist = sqrt16(dx * dx + dy * dy); | 20 | uint8_t dist = sqrt16(dx * dx + dy * dy); |
| 22 | int16_t dist2 = 8; | 21 | int16_t dist2 = 8; |
| 23 | uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist; | 22 | uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist; |
diff --git a/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h b/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h index 9fc4d527a..abc7e36a8 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h +++ b/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 2 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 3 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE | 3 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE |
| 4 | 4 | ||
| 5 | extern led_config_t g_led_config; | ||
| 5 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 6 | extern last_hit_t g_last_hit_tracker; | 7 | extern last_hit_t g_last_hit_tracker; |
| 7 | 8 | ||
diff --git a/quantum/rgb_matrix_animations/solid_reactive_wide.h b/quantum/rgb_matrix_animations/solid_reactive_wide.h index d86cb1284..3d1d38e80 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_wide.h +++ b/quantum/rgb_matrix_animations/solid_reactive_wide.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 2 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 3 | #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) | 3 | #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) |
| 4 | 4 | ||
| 5 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 5 | extern led_config_t g_led_config; |
| 6 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 7 | extern last_hit_t g_last_hit_tracker; | 7 | extern last_hit_t g_last_hit_tracker; |
| 8 | 8 | ||
| @@ -13,11 +13,10 @@ static bool rgb_matrix_solid_reactive_multiwide_range(uint8_t start, effect_para | |||
| 13 | uint8_t count = g_last_hit_tracker.count; | 13 | uint8_t count = g_last_hit_tracker.count; |
| 14 | for (uint8_t i = led_min; i < led_max; i++) { | 14 | for (uint8_t i = led_min; i < led_max; i++) { |
| 15 | hsv.v = 0; | 15 | hsv.v = 0; |
| 16 | point_t point = g_rgb_leds[i].point; | ||
| 17 | for (uint8_t j = start; j < count; j++) { | 16 | for (uint8_t j = start; j < count; j++) { |
| 18 | RGB_MATRIX_TEST_LED_FLAGS(); | 17 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 19 | int16_t dx = point.x - g_last_hit_tracker.x[j]; | 18 | int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; |
| 20 | int16_t dy = point.y - g_last_hit_tracker.y[j]; | 19 | int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; |
| 21 | uint8_t dist = sqrt16(dx * dx + dy * dy); | 20 | uint8_t dist = sqrt16(dx * dx + dy * dy); |
| 22 | uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) + dist * 5; | 21 | uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) + dist * 5; |
| 23 | if (effect > 255) | 22 | if (effect > 255) |
diff --git a/quantum/rgb_matrix_animations/solid_splash_anim.h b/quantum/rgb_matrix_animations/solid_splash_anim.h index 14312f33d..4e5565d0d 100644 --- a/quantum/rgb_matrix_animations/solid_splash_anim.h +++ b/quantum/rgb_matrix_animations/solid_splash_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 2 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 3 | #if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH) | 3 | #if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH) |
| 4 | 4 | ||
| 5 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 5 | extern led_config_t g_led_config; |
| 6 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 7 | extern last_hit_t g_last_hit_tracker; | 7 | extern last_hit_t g_last_hit_tracker; |
| 8 | 8 | ||
| @@ -14,10 +14,9 @@ static bool rgb_matrix_solid_multisplash_range(uint8_t start, effect_params_t* p | |||
| 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 | hsv.v = 0; | 16 | hsv.v = 0; |
| 17 | point_t point = g_rgb_leds[i].point; | ||
| 18 | for (uint8_t j = start; j < count; j++) { | 17 | for (uint8_t j = start; j < count; j++) { |
| 19 | int16_t dx = point.x - g_last_hit_tracker.x[j]; | 18 | int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; |
| 20 | int16_t dy = point.y - g_last_hit_tracker.y[j]; | 19 | int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; |
| 21 | uint8_t dist = sqrt16(dx * dx + dy * dy); | 20 | uint8_t dist = sqrt16(dx * dx + dy * dy); |
| 22 | uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist; | 21 | uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist; |
| 23 | if (effect > 255) | 22 | if (effect > 255) |
diff --git a/quantum/rgb_matrix_animations/splash_anim.h b/quantum/rgb_matrix_animations/splash_anim.h index 3c96d451e..fbe776111 100644 --- a/quantum/rgb_matrix_animations/splash_anim.h +++ b/quantum/rgb_matrix_animations/splash_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 2 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 3 | #if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH) | 3 | #if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH) |
| 4 | 4 | ||
| 5 | extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; | 5 | extern led_config_t g_led_config; |
| 6 | extern rgb_config_t rgb_matrix_config; | 6 | extern rgb_config_t rgb_matrix_config; |
| 7 | extern last_hit_t g_last_hit_tracker; | 7 | extern last_hit_t g_last_hit_tracker; |
| 8 | 8 | ||
| @@ -15,10 +15,9 @@ static bool rgb_matrix_multisplash_range(uint8_t start, effect_params_t* params) | |||
| 15 | RGB_MATRIX_TEST_LED_FLAGS(); | 15 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 16 | hsv.h = rgb_matrix_config.hue; | 16 | hsv.h = rgb_matrix_config.hue; |
| 17 | hsv.v = 0; | 17 | hsv.v = 0; |
| 18 | point_t point = g_rgb_leds[i].point; | ||
| 19 | for (uint8_t j = start; j < count; j++) { | 18 | for (uint8_t j = start; j < count; j++) { |
| 20 | int16_t dx = point.x - g_last_hit_tracker.x[j]; | 19 | int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; |
| 21 | int16_t dy = point.y - g_last_hit_tracker.y[j]; | 20 | int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; |
| 22 | uint8_t dist = sqrt16(dx * dx + dy * dy); | 21 | uint8_t dist = sqrt16(dx * dx + dy * dy); |
| 23 | uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist; | 22 | uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist; |
| 24 | if (effect > 255) | 23 | if (effect > 255) |
