diff options
42 files changed, 126 insertions, 118 deletions
diff --git a/keyboards/dztech/dz60rgb/keymaps/matthewrobo/keymap.c b/keyboards/dztech/dz60rgb/keymaps/matthewrobo/keymap.c index 600ac8619..a12358c8d 100644 --- a/keyboards/dztech/dz60rgb/keymaps/matthewrobo/keymap.c +++ b/keyboards/dztech/dz60rgb/keymaps/matthewrobo/keymap.c | |||
@@ -146,7 +146,7 @@ void rgb_matrix_indicators_user(void) | |||
146 | break; | 146 | break; |
147 | 147 | ||
148 | case _RGB: { | 148 | case _RGB: { |
149 | HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val }; | 149 | HSV hsv = { rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v }; |
150 | HSV hui = hsv; | 150 | HSV hui = hsv; |
151 | HSV hud = hsv; | 151 | HSV hud = hsv; |
152 | HSV sai = hsv; | 152 | HSV sai = hsv; |
diff --git a/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c b/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c index 11b4d70ca..447b0aca1 100644 --- a/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c +++ b/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c | |||
@@ -135,7 +135,7 @@ void rgb_matrix_indicators_user(void) | |||
135 | break; | 135 | break; |
136 | 136 | ||
137 | case _FNC: { | 137 | case _FNC: { |
138 | HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val }; | 138 | HSV hsv = { rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v }; |
139 | HSV hui = hsv; | 139 | HSV hui = hsv; |
140 | HSV hud = hsv; | 140 | HSV hud = hsv; |
141 | HSV sai = hsv; | 141 | HSV sai = hsv; |
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index 98baf5cb5..d20daf5e4 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c | |||
@@ -128,9 +128,7 @@ void eeconfig_update_rgb_matrix_default(void) { | |||
128 | dprintf("eeconfig_update_rgb_matrix_default\n"); | 128 | dprintf("eeconfig_update_rgb_matrix_default\n"); |
129 | rgb_matrix_config.enable = 1; | 129 | rgb_matrix_config.enable = 1; |
130 | rgb_matrix_config.mode = RGB_MATRIX_STARTUP_MODE; | 130 | rgb_matrix_config.mode = RGB_MATRIX_STARTUP_MODE; |
131 | rgb_matrix_config.hue = 0; | 131 | rgb_matrix_config.hsv = (HSV){ 0, UINT8_MAX, RGB_MATRIX_MAXIMUM_BRIGHTNESS }; |
132 | rgb_matrix_config.sat = UINT8_MAX; | ||
133 | rgb_matrix_config.val = RGB_MATRIX_MAXIMUM_BRIGHTNESS; | ||
134 | rgb_matrix_config.speed = UINT8_MAX / 2; | 132 | rgb_matrix_config.speed = UINT8_MAX / 2; |
135 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); | 133 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); |
136 | } | 134 | } |
@@ -139,9 +137,9 @@ void eeconfig_debug_rgb_matrix(void) { | |||
139 | dprintf("rgb_matrix_config eprom\n"); | 137 | dprintf("rgb_matrix_config eprom\n"); |
140 | dprintf("rgb_matrix_config.enable = %d\n", rgb_matrix_config.enable); | 138 | dprintf("rgb_matrix_config.enable = %d\n", rgb_matrix_config.enable); |
141 | dprintf("rgb_matrix_config.mode = %d\n", rgb_matrix_config.mode); | 139 | dprintf("rgb_matrix_config.mode = %d\n", rgb_matrix_config.mode); |
142 | dprintf("rgb_matrix_config.hue = %d\n", rgb_matrix_config.hue); | 140 | dprintf("rgb_matrix_config.hsv.h = %d\n", rgb_matrix_config.hsv.h); |
143 | dprintf("rgb_matrix_config.sat = %d\n", rgb_matrix_config.sat); | 141 | dprintf("rgb_matrix_config.hsv.s = %d\n", rgb_matrix_config.hsv.s); |
144 | dprintf("rgb_matrix_config.val = %d\n", rgb_matrix_config.val); | 142 | dprintf("rgb_matrix_config.hsv.v = %d\n", rgb_matrix_config.hsv.v); |
145 | dprintf("rgb_matrix_config.speed = %d\n", rgb_matrix_config.speed); | 143 | dprintf("rgb_matrix_config.speed = %d\n", rgb_matrix_config.speed); |
146 | } | 144 | } |
147 | 145 | ||
@@ -492,34 +490,34 @@ void rgb_matrix_step_reverse(void) { | |||
492 | } | 490 | } |
493 | 491 | ||
494 | void rgb_matrix_increase_hue(void) { | 492 | void rgb_matrix_increase_hue(void) { |
495 | rgb_matrix_config.hue += RGB_MATRIX_HUE_STEP; | 493 | rgb_matrix_config.hsv.h += RGB_MATRIX_HUE_STEP; |
496 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); | 494 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); |
497 | } | 495 | } |
498 | 496 | ||
499 | void rgb_matrix_decrease_hue(void) { | 497 | void rgb_matrix_decrease_hue(void) { |
500 | rgb_matrix_config.hue -= RGB_MATRIX_HUE_STEP; | 498 | rgb_matrix_config.hsv.h -= RGB_MATRIX_HUE_STEP; |
501 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); | 499 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); |
502 | } | 500 | } |
503 | 501 | ||
504 | void rgb_matrix_increase_sat(void) { | 502 | void rgb_matrix_increase_sat(void) { |
505 | rgb_matrix_config.sat = qadd8(rgb_matrix_config.sat, RGB_MATRIX_SAT_STEP); | 503 | rgb_matrix_config.hsv.s = qadd8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP); |
506 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); | 504 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); |
507 | } | 505 | } |
508 | 506 | ||
509 | void rgb_matrix_decrease_sat(void) { | 507 | void rgb_matrix_decrease_sat(void) { |
510 | rgb_matrix_config.sat = qsub8(rgb_matrix_config.sat, RGB_MATRIX_SAT_STEP); | 508 | rgb_matrix_config.hsv.s = qsub8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP); |
511 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); | 509 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); |
512 | } | 510 | } |
513 | 511 | ||
514 | void rgb_matrix_increase_val(void) { | 512 | void rgb_matrix_increase_val(void) { |
515 | rgb_matrix_config.val = qadd8(rgb_matrix_config.val, RGB_MATRIX_VAL_STEP); | 513 | rgb_matrix_config.hsv.v = qadd8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP); |
516 | if (rgb_matrix_config.val > RGB_MATRIX_MAXIMUM_BRIGHTNESS) | 514 | if (rgb_matrix_config.hsv.v > RGB_MATRIX_MAXIMUM_BRIGHTNESS) |
517 | rgb_matrix_config.val = RGB_MATRIX_MAXIMUM_BRIGHTNESS; | 515 | rgb_matrix_config.hsv.v = RGB_MATRIX_MAXIMUM_BRIGHTNESS; |
518 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); | 516 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); |
519 | } | 517 | } |
520 | 518 | ||
521 | void rgb_matrix_decrease_val(void) { | 519 | void rgb_matrix_decrease_val(void) { |
522 | rgb_matrix_config.val = qsub8(rgb_matrix_config.val, RGB_MATRIX_VAL_STEP); | 520 | rgb_matrix_config.hsv.v = qsub8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP); |
523 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); | 521 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); |
524 | } | 522 | } |
525 | 523 | ||
@@ -561,9 +559,9 @@ void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val) { | |||
561 | } | 559 | } |
562 | 560 | ||
563 | void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { | 561 | void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { |
564 | rgb_matrix_config.hue = hue; | 562 | rgb_matrix_config.hsv.h = hue; |
565 | rgb_matrix_config.sat = sat; | 563 | rgb_matrix_config.hsv.s = sat; |
566 | rgb_matrix_config.val = val; | 564 | rgb_matrix_config.hsv.v = val; |
567 | if (rgb_matrix_config.val > RGB_MATRIX_MAXIMUM_BRIGHTNESS) | 565 | if (rgb_matrix_config.hsv.v > RGB_MATRIX_MAXIMUM_BRIGHTNESS) |
568 | rgb_matrix_config.val = RGB_MATRIX_MAXIMUM_BRIGHTNESS; | 566 | rgb_matrix_config.hsv.v = RGB_MATRIX_MAXIMUM_BRIGHTNESS; |
569 | } | 567 | } |
diff --git a/quantum/rgb_matrix_animations/alpha_mods_anim.h b/quantum/rgb_matrix_animations/alpha_mods_anim.h index 0fee19aef..8df3356f6 100644 --- a/quantum/rgb_matrix_animations/alpha_mods_anim.h +++ b/quantum/rgb_matrix_animations/alpha_mods_anim.h | |||
@@ -6,7 +6,7 @@ RGB_MATRIX_EFFECT(ALPHAS_MODS) | |||
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.hue, rgb_matrix_config.sat, rgb_matrix_config.val }; | 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); |
diff --git a/quantum/rgb_matrix_animations/breathing_anim.h b/quantum/rgb_matrix_animations/breathing_anim.h index c357b5303..0af7b42cf 100644 --- a/quantum/rgb_matrix_animations/breathing_anim.h +++ b/quantum/rgb_matrix_animations/breathing_anim.h | |||
@@ -5,9 +5,9 @@ RGB_MATRIX_EFFECT(BREATHING) | |||
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 | 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); |
9 | uint8_t val = scale8(abs8(sin8(time) - 128) * 2, rgb_matrix_config.val); | 10 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); |
10 | HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, val }; | ||
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(); |
diff --git a/quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h b/quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h index 3739cde1f..4585c5271 100644 --- a/quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h +++ b/quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h | |||
@@ -2,8 +2,9 @@ | |||
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 void 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(rgb_matrix_config.sat - time - atan2_8(dy, dx) * 3, rgb_matrix_config.sat); | 6 | hsv.s = scale8(hsv.s - time - atan2_8(dy, dx) * 3, hsv.s); |
7 | return hsv; | ||
7 | } | 8 | } |
8 | 9 | ||
9 | bool BAND_PINWHEEL_SAT(effect_params_t* params) { | 10 | bool BAND_PINWHEEL_SAT(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h b/quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h index 6e5871d7e..5cdb87348 100644 --- a/quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h +++ b/quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h | |||
@@ -2,8 +2,9 @@ | |||
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 void 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(rgb_matrix_config.val - time - atan2_8(dy, dx) * 3, rgb_matrix_config.val); | 6 | hsv.v = scale8(hsv.v - time - atan2_8(dy, dx) * 3, hsv.v); |
7 | return hsv; | ||
7 | } | 8 | } |
8 | 9 | ||
9 | bool BAND_PINWHEEL_VAL(effect_params_t* params) { | 10 | bool BAND_PINWHEEL_VAL(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/colorband_sat_anim.h b/quantum/rgb_matrix_animations/colorband_sat_anim.h index bfa1085cb..a5175f1cd 100644 --- a/quantum/rgb_matrix_animations/colorband_sat_anim.h +++ b/quantum/rgb_matrix_animations/colorband_sat_anim.h | |||
@@ -2,9 +2,10 @@ | |||
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 void 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 = rgb_matrix_config.sat - 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, rgb_matrix_config.sat); | 7 | hsv.s = scale8(s < 0 ? 0 : s, hsv.s); |
8 | return hsv; | ||
8 | } | 9 | } |
9 | 10 | ||
10 | bool BAND_SAT(effect_params_t* params) { | 11 | bool BAND_SAT(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h b/quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h index 7db01c5f9..096c675de 100644 --- a/quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h +++ b/quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h | |||
@@ -2,8 +2,9 @@ | |||
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 void 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(rgb_matrix_config.sat + dist - time - atan2_8(dy, dx), rgb_matrix_config.sat); | 6 | hsv.s = scale8(hsv.s + dist - time - atan2_8(dy, dx), hsv.s); |
7 | return hsv; | ||
7 | } | 8 | } |
8 | 9 | ||
9 | bool BAND_SPIRAL_SAT(effect_params_t* params) { | 10 | bool BAND_SPIRAL_SAT(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/colorband_spiral_val_anim.h b/quantum/rgb_matrix_animations/colorband_spiral_val_anim.h index a16f8e2ce..1d4cc0c84 100644 --- a/quantum/rgb_matrix_animations/colorband_spiral_val_anim.h +++ b/quantum/rgb_matrix_animations/colorband_spiral_val_anim.h | |||
@@ -2,8 +2,9 @@ | |||
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 void 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(rgb_matrix_config.val + dist - time - atan2_8(dy, dx), rgb_matrix_config.val); | 6 | hsv.v = scale8(hsv.v + dist - time - atan2_8(dy, dx), hsv.v); |
7 | return hsv; | ||
7 | } | 8 | } |
8 | 9 | ||
9 | bool BAND_SPIRAL_VAL(effect_params_t* params) { | 10 | bool BAND_SPIRAL_VAL(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/colorband_val_anim.h b/quantum/rgb_matrix_animations/colorband_val_anim.h index 4b76924db..de0bbb471 100644 --- a/quantum/rgb_matrix_animations/colorband_val_anim.h +++ b/quantum/rgb_matrix_animations/colorband_val_anim.h | |||
@@ -2,9 +2,10 @@ | |||
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 void 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 = rgb_matrix_config.val - 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, rgb_matrix_config.val); | 7 | hsv.v = scale8(v < 0 ? 0 : v, hsv.v); |
8 | return hsv; | ||
8 | } | 9 | } |
9 | 10 | ||
10 | bool BAND_VAL(effect_params_t* params) { | 11 | bool BAND_VAL(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/cycle_all_anim.h b/quantum/rgb_matrix_animations/cycle_all_anim.h index 380dbe05a..0c45aba8b 100644 --- a/quantum/rgb_matrix_animations/cycle_all_anim.h +++ b/quantum/rgb_matrix_animations/cycle_all_anim.h | |||
@@ -2,9 +2,9 @@ | |||
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 void 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 | { | 6 | hsv.h = time; |
7 | hsv->h = time; | 7 | return hsv; |
8 | } | 8 | } |
9 | 9 | ||
10 | bool CYCLE_ALL(effect_params_t* params) { | 10 | bool 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 f270fb42c..d2e5b4fbd 100644 --- a/quantum/rgb_matrix_animations/cycle_left_right_anim.h +++ b/quantum/rgb_matrix_animations/cycle_left_right_anim.h | |||
@@ -2,8 +2,9 @@ | |||
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 void 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 | } | 8 | } |
8 | 9 | ||
9 | bool CYCLE_LEFT_RIGHT(effect_params_t* params) { | 10 | bool CYCLE_LEFT_RIGHT(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/cycle_out_in_anim.h b/quantum/rgb_matrix_animations/cycle_out_in_anim.h index 46c7efef2..fa7c3b09c 100644 --- a/quantum/rgb_matrix_animations/cycle_out_in_anim.h +++ b/quantum/rgb_matrix_animations/cycle_out_in_anim.h | |||
@@ -2,8 +2,9 @@ | |||
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 void 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 | } | 8 | } |
8 | 9 | ||
9 | bool CYCLE_OUT_IN(effect_params_t* params) { | 10 | bool CYCLE_OUT_IN(effect_params_t* params) { |
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 2fdb4ba91..74a2c9aa5 100644 --- a/quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h +++ b/quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h | |||
@@ -2,10 +2,11 @@ | |||
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 void 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 | } | 10 | } |
10 | 11 | ||
11 | bool CYCLE_OUT_IN_DUAL(effect_params_t* params) { | 12 | bool CYCLE_OUT_IN_DUAL(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/cycle_pinwheel_anim.h b/quantum/rgb_matrix_animations/cycle_pinwheel_anim.h index 29e2d92c9..54e222dc2 100644 --- a/quantum/rgb_matrix_animations/cycle_pinwheel_anim.h +++ b/quantum/rgb_matrix_animations/cycle_pinwheel_anim.h | |||
@@ -2,8 +2,9 @@ | |||
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 void 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 | } | 8 | } |
8 | 9 | ||
9 | bool CYCLE_PINWHEEL(effect_params_t* params) { | 10 | bool CYCLE_PINWHEEL(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/cycle_spiral_anim.h b/quantum/rgb_matrix_animations/cycle_spiral_anim.h index a1354f60c..b27d7a83c 100644 --- a/quantum/rgb_matrix_animations/cycle_spiral_anim.h +++ b/quantum/rgb_matrix_animations/cycle_spiral_anim.h | |||
@@ -2,8 +2,9 @@ | |||
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 void 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 | } | 8 | } |
8 | 9 | ||
9 | bool CYCLE_SPIRAL(effect_params_t* params) { | 10 | bool CYCLE_SPIRAL(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/cycle_up_down_anim.h b/quantum/rgb_matrix_animations/cycle_up_down_anim.h index b3ef4cdf2..4bf8ef2ae 100644 --- a/quantum/rgb_matrix_animations/cycle_up_down_anim.h +++ b/quantum/rgb_matrix_animations/cycle_up_down_anim.h | |||
@@ -2,8 +2,9 @@ | |||
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 void 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 | } | 8 | } |
8 | 9 | ||
9 | bool CYCLE_UP_DOWN(effect_params_t* params) { | 10 | bool CYCLE_UP_DOWN(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/dual_beacon_anim.h b/quantum/rgb_matrix_animations/dual_beacon_anim.h index d34f146a5..336a41b2c 100644 --- a/quantum/rgb_matrix_animations/dual_beacon_anim.h +++ b/quantum/rgb_matrix_animations/dual_beacon_anim.h | |||
@@ -2,8 +2,9 @@ | |||
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 void 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 + rgb_matrix_config.hue; | 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 | } | 8 | } |
8 | 9 | ||
9 | bool DUAL_BEACON(effect_params_t* params) { | 10 | bool DUAL_BEACON(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/gradient_up_down_anim.h b/quantum/rgb_matrix_animations/gradient_up_down_anim.h index d9fcd4d98..12848ab4c 100644 --- a/quantum/rgb_matrix_animations/gradient_up_down_anim.h +++ b/quantum/rgb_matrix_animations/gradient_up_down_anim.h | |||
@@ -5,13 +5,13 @@ RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN) | |||
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 = { 0, rgb_matrix_config.sat, rgb_matrix_config.val }; | 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.hue + 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 | } |
diff --git a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h index 8f0b1bd91..bffa0a42d 100644 --- a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h +++ b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h | |||
@@ -4,7 +4,7 @@ RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS) | |||
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.val }; | 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 | } |
diff --git a/quantum/rgb_matrix_animations/rainbow_beacon_anim.h b/quantum/rgb_matrix_animations/rainbow_beacon_anim.h index 061cac837..f53c819a9 100644 --- a/quantum/rgb_matrix_animations/rainbow_beacon_anim.h +++ b/quantum/rgb_matrix_animations/rainbow_beacon_anim.h | |||
@@ -2,8 +2,9 @@ | |||
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 void 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 + rgb_matrix_config.hue; | 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 | } | 8 | } |
8 | 9 | ||
9 | bool RAINBOW_BEACON(effect_params_t* params) { | 10 | bool RAINBOW_BEACON(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h b/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h index f406566fa..e78c55e8d 100644 --- a/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h +++ b/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h | |||
@@ -2,8 +2,9 @@ | |||
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 void 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) + rgb_matrix_config.hue; | 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 | } | 8 | } |
8 | 9 | ||
9 | bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) { | 10 | bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h b/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h index f19e9116d..8298fec46 100644 --- a/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h +++ b/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h | |||
@@ -2,8 +2,9 @@ | |||
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 void 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 + rgb_matrix_config.hue; | 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 | } | 8 | } |
8 | 9 | ||
9 | bool PINWHEELS(effect_params_t* params) { | 10 | bool PINWHEELS(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/raindrops_anim.h b/quantum/rgb_matrix_animations/raindrops_anim.h index 09d0d1df8..a4fed5165 100644 --- a/quantum/rgb_matrix_animations/raindrops_anim.h +++ b/quantum/rgb_matrix_animations/raindrops_anim.h | |||
@@ -4,17 +4,17 @@ RGB_MATRIX_EFFECT(RAINDROPS) | |||
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.sat, rgb_matrix_config.val }; | 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.hue + 180) % 360 - rgb_matrix_config.hue) / 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.hue + (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 | } |
diff --git a/quantum/rgb_matrix_animations/solid_color_anim.h b/quantum/rgb_matrix_animations/solid_color_anim.h index 937642559..6e4063803 100644 --- a/quantum/rgb_matrix_animations/solid_color_anim.h +++ b/quantum/rgb_matrix_animations/solid_color_anim.h | |||
@@ -4,8 +4,7 @@ RGB_MATRIX_EFFECT(SOLID_COLOR) | |||
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 | HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val }; | 7 | RGB rgb = hsv_to_rgb(rgb_matrix_config.hsv); |
8 | RGB rgb = hsv_to_rgb(hsv); | ||
9 | for (uint8_t i = led_min; i < led_max; i++) { | 8 | for (uint8_t i = led_min; i < led_max; i++) { |
10 | RGB_MATRIX_TEST_LED_FLAGS(); | 9 | RGB_MATRIX_TEST_LED_FLAGS(); |
11 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 10 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
diff --git a/quantum/rgb_matrix_animations/solid_reactive_anim.h b/quantum/rgb_matrix_animations/solid_reactive_anim.h index 762a95db3..dd49b6530 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_anim.h +++ b/quantum/rgb_matrix_animations/solid_reactive_anim.h | |||
@@ -3,8 +3,9 @@ | |||
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 void SOLID_REACTIVE_math(HSV* hsv, uint16_t offset) { | 6 | static HSV SOLID_REACTIVE_math(HSV hsv, uint16_t offset) { |
7 | hsv->h = rgb_matrix_config.hue + qsub8(130, offset); | 7 | hsv.h += qsub8(130, offset); |
8 | return hsv; | ||
8 | } | 9 | } |
9 | 10 | ||
10 | bool SOLID_REACTIVE(effect_params_t* params) { | 11 | bool SOLID_REACTIVE(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/solid_reactive_cross.h b/quantum/rgb_matrix_animations/solid_reactive_cross.h index 99f22c694..5b9cfcbd5 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_cross.h +++ b/quantum/rgb_matrix_animations/solid_reactive_cross.h | |||
@@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS) | |||
11 | 11 | ||
12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
13 | 13 | ||
14 | static void 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; |
@@ -20,7 +20,8 @@ static void SOLID_REACTIVE_CROSS_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t | |||
20 | effect += dx > dy ? dy : dx; | 20 | effect += dx > dy ? dy : dx; |
21 | if (effect > 255) | 21 | if (effect > 255) |
22 | effect = 255; | 22 | effect = 255; |
23 | hsv->v = qadd8(hsv->v, 255 - effect); | 23 | hsv.v = qadd8(hsv.v, 255 - effect); |
24 | return hsv; | ||
24 | } | 25 | } |
25 | 26 | ||
26 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS | 27 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS |
diff --git a/quantum/rgb_matrix_animations/solid_reactive_nexus.h b/quantum/rgb_matrix_animations/solid_reactive_nexus.h index 8bebd042d..e90eaf4b2 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_nexus.h +++ b/quantum/rgb_matrix_animations/solid_reactive_nexus.h | |||
@@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS) | |||
11 | 11 | ||
12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
13 | 13 | ||
14 | static void 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) |
17 | effect = 255; | 17 | effect = 255; |
@@ -19,8 +19,9 @@ static void SOLID_REACTIVE_NEXUS_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t | |||
19 | effect = 255; | 19 | effect = 255; |
20 | if ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) | 20 | if ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) |
21 | effect = 255; | 21 | effect = 255; |
22 | hsv->v = qadd8(hsv->v, 255 - effect); | 22 | hsv.v = qadd8(hsv.v, 255 - effect); |
23 | hsv->h = rgb_matrix_config.hue + dy / 4; | 23 | hsv.h = rgb_matrix_config.hsv.h + dy / 4; |
24 | return hsv; | ||
24 | } | 25 | } |
25 | 26 | ||
26 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS | 27 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS |
diff --git a/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h b/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h index 36c6ec527..77c8ff672 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h +++ b/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h | |||
@@ -3,8 +3,9 @@ | |||
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 void 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, rgb_matrix_config.val); | 7 | hsv.v = scale8(255 - offset, hsv.v); |
8 | return hsv; | ||
8 | } | 9 | } |
9 | 10 | ||
10 | bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { | 11 | bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { |
diff --git a/quantum/rgb_matrix_animations/solid_reactive_wide.h b/quantum/rgb_matrix_animations/solid_reactive_wide.h index 36edc475c..73779dfa7 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_wide.h +++ b/quantum/rgb_matrix_animations/solid_reactive_wide.h | |||
@@ -11,11 +11,12 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE) | |||
11 | 11 | ||
12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
13 | 13 | ||
14 | static void 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) |
17 | effect = 255; | 17 | effect = 255; |
18 | hsv->v = qadd8(hsv->v, 255 - effect); | 18 | hsv.v = qadd8(hsv.v, 255 - effect); |
19 | return hsv; | ||
19 | } | 20 | } |
20 | 21 | ||
21 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE | 22 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE |
diff --git a/quantum/rgb_matrix_animations/solid_splash_anim.h b/quantum/rgb_matrix_animations/solid_splash_anim.h index 84c99ff00..441f35576 100644 --- a/quantum/rgb_matrix_animations/solid_splash_anim.h +++ b/quantum/rgb_matrix_animations/solid_splash_anim.h | |||
@@ -11,11 +11,12 @@ RGB_MATRIX_EFFECT(SOLID_MULTISPLASH) | |||
11 | 11 | ||
12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
13 | 13 | ||
14 | void 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) |
17 | effect = 255; | 17 | effect = 255; |
18 | hsv->v = qadd8(hsv->v, 255 - effect); | 18 | hsv.v = qadd8(hsv.v, 255 - effect); |
19 | return hsv; | ||
19 | } | 20 | } |
20 | 21 | ||
21 | #ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH | 22 | #ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH |
diff --git a/quantum/rgb_matrix_animations/splash_anim.h b/quantum/rgb_matrix_animations/splash_anim.h index c4c051653..19ccb256e 100644 --- a/quantum/rgb_matrix_animations/splash_anim.h +++ b/quantum/rgb_matrix_animations/splash_anim.h | |||
@@ -11,12 +11,13 @@ RGB_MATRIX_EFFECT(MULTISPLASH) | |||
11 | 11 | ||
12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
13 | 13 | ||
14 | void 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) |
17 | effect = 255; | 17 | effect = 255; |
18 | hsv->h += effect; | 18 | hsv.h += effect; |
19 | hsv->v = qadd8(hsv->v, 255 - effect); | 19 | hsv.v = qadd8(hsv.v, 255 - effect); |
20 | return hsv; | ||
20 | } | 21 | } |
21 | 22 | ||
22 | #ifndef DISABLE_RGB_MATRIX_SPLASH | 23 | #ifndef DISABLE_RGB_MATRIX_SPLASH |
diff --git a/quantum/rgb_matrix_animations/typing_heatmap_anim.h b/quantum/rgb_matrix_animations/typing_heatmap_anim.h index e6b34717b..374b7fea0 100644 --- a/quantum/rgb_matrix_animations/typing_heatmap_anim.h +++ b/quantum/rgb_matrix_animations/typing_heatmap_anim.h | |||
@@ -59,7 +59,7 @@ bool TYPING_HEATMAP(effect_params_t* params) { | |||
59 | if (!HAS_ANY_FLAGS(g_led_config.flags[led[j]], params->flags)) | 59 | if (!HAS_ANY_FLAGS(g_led_config.flags[led[j]], params->flags)) |
60 | continue; | 60 | continue; |
61 | 61 | ||
62 | HSV hsv = { 170 - qsub8(val, 85), rgb_matrix_config.sat, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.val) }; | 62 | 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); | 63 | RGB rgb = hsv_to_rgb(hsv); |
64 | rgb_matrix_set_color(led[j], rgb.r, rgb.g, rgb.b); | 64 | rgb_matrix_set_color(led[j], rgb.r, rgb.g, rgb.b); |
65 | } | 65 | } |
diff --git a/quantum/rgb_matrix_runners/effect_runner_dx_dy.h b/quantum/rgb_matrix_runners/effect_runner_dx_dy.h index 43312629d..9650c9a13 100644 --- a/quantum/rgb_matrix_runners/effect_runner_dx_dy.h +++ b/quantum/rgb_matrix_runners/effect_runner_dx_dy.h | |||
@@ -1,18 +1,16 @@ | |||
1 | #pragma once | 1 | #pragma once |
2 | 2 | ||
3 | typedef void (*dx_dy_f)(HSV* hsv, int16_t dx, int16_t dy, uint8_t time); | 3 | typedef HSV (*dx_dy_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t time); |
4 | 4 | ||
5 | bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) { | 5 | bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) { |
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.hue, rgb_matrix_config.sat, rgb_matrix_config.val }; | ||
9 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2); | 8 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2); |
10 | for (uint8_t i = led_min; i < led_max; i++) { | 9 | for (uint8_t i = led_min; i < led_max; i++) { |
11 | RGB_MATRIX_TEST_LED_FLAGS(); | 10 | RGB_MATRIX_TEST_LED_FLAGS(); |
12 | int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; | 11 | int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; |
13 | int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; | 12 | int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; |
14 | effect_func(&hsv, dx, dy, time); | 13 | RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); |
15 | RGB rgb = hsv_to_rgb(hsv); | ||
16 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 14 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
17 | } | 15 | } |
18 | return led_max < DRIVER_LED_TOTAL; | 16 | return led_max < DRIVER_LED_TOTAL; |
diff --git a/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h b/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h index a7310c853..eb0c4d8dd 100644 --- a/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h +++ b/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h | |||
@@ -1,19 +1,17 @@ | |||
1 | #pragma once | 1 | #pragma once |
2 | 2 | ||
3 | typedef void (*dx_dy_dist_f)(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time); | 3 | typedef HSV (*dx_dy_dist_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time); |
4 | 4 | ||
5 | bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) { | 5 | bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) { |
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.hue, rgb_matrix_config.sat, rgb_matrix_config.val }; | ||
9 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2); | 8 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2); |
10 | for (uint8_t i = led_min; i < led_max; i++) { | 9 | for (uint8_t i = led_min; i < led_max; i++) { |
11 | RGB_MATRIX_TEST_LED_FLAGS(); | 10 | RGB_MATRIX_TEST_LED_FLAGS(); |
12 | int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; | 11 | int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; |
13 | int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; | 12 | int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; |
14 | uint8_t dist = sqrt16(dx * dx + dy * dy); | 13 | uint8_t dist = sqrt16(dx * dx + dy * dy); |
15 | effect_func(&hsv, dx, dy, dist, time); | 14 | RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, dist, time)); |
16 | RGB rgb = hsv_to_rgb(hsv); | ||
17 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 15 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
18 | } | 16 | } |
19 | return led_max < DRIVER_LED_TOTAL; | 17 | return led_max < DRIVER_LED_TOTAL; |
diff --git a/quantum/rgb_matrix_runners/effect_runner_i.h b/quantum/rgb_matrix_runners/effect_runner_i.h index 85405ba1b..d4a7ef392 100644 --- a/quantum/rgb_matrix_runners/effect_runner_i.h +++ b/quantum/rgb_matrix_runners/effect_runner_i.h | |||
@@ -1,16 +1,14 @@ | |||
1 | #pragma once | 1 | #pragma once |
2 | 2 | ||
3 | typedef void (*i_f)(HSV* hsv, uint8_t i, uint8_t time); | 3 | typedef HSV (*i_f)(HSV hsv, uint8_t i, uint8_t time); |
4 | 4 | ||
5 | bool effect_runner_i(effect_params_t* params, i_f effect_func) { | 5 | bool effect_runner_i(effect_params_t* params, i_f effect_func) { |
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.hue, rgb_matrix_config.sat, rgb_matrix_config.val }; | ||
9 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); | 8 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); |
10 | for (uint8_t i = led_min; i < led_max; i++) { | 9 | for (uint8_t i = led_min; i < led_max; i++) { |
11 | RGB_MATRIX_TEST_LED_FLAGS(); | 10 | RGB_MATRIX_TEST_LED_FLAGS(); |
12 | effect_func(&hsv, i, time); | 11 | RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); |
13 | RGB rgb = hsv_to_rgb(hsv); | ||
14 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 12 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
15 | } | 13 | } |
16 | return led_max < DRIVER_LED_TOTAL; | 14 | return led_max < DRIVER_LED_TOTAL; |
diff --git a/quantum/rgb_matrix_runners/effect_runner_reactive.h b/quantum/rgb_matrix_runners/effect_runner_reactive.h index 94cd7d545..9da2814ce 100644 --- a/quantum/rgb_matrix_runners/effect_runner_reactive.h +++ b/quantum/rgb_matrix_runners/effect_runner_reactive.h | |||
@@ -2,12 +2,11 @@ | |||
2 | 2 | ||
3 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 3 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
4 | 4 | ||
5 | typedef void (*reactive_f)(HSV* hsv, uint16_t offset); | 5 | typedef HSV (*reactive_f)(HSV hsv, uint16_t offset); |
6 | 6 | ||
7 | bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) { | 7 | bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) { |
8 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 8 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
9 | 9 | ||
10 | HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val }; | ||
11 | uint16_t max_tick = 65535 / rgb_matrix_config.speed; | 10 | uint16_t max_tick = 65535 / rgb_matrix_config.speed; |
12 | for (uint8_t i = led_min; i < led_max; i++) { | 11 | for (uint8_t i = led_min; i < led_max; i++) { |
13 | RGB_MATRIX_TEST_LED_FLAGS(); | 12 | RGB_MATRIX_TEST_LED_FLAGS(); |
@@ -21,8 +20,7 @@ bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) { | |||
21 | } | 20 | } |
22 | 21 | ||
23 | uint16_t offset = scale16by8(tick, rgb_matrix_config.speed); | 22 | uint16_t offset = scale16by8(tick, rgb_matrix_config.speed); |
24 | effect_func(&hsv, offset); | 23 | RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, offset)); |
25 | RGB rgb = hsv_to_rgb(hsv); | ||
26 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 24 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
27 | } | 25 | } |
28 | return led_max < DRIVER_LED_TOTAL; | 26 | return led_max < DRIVER_LED_TOTAL; |
diff --git a/quantum/rgb_matrix_runners/effect_runner_reactive_splash.h b/quantum/rgb_matrix_runners/effect_runner_reactive_splash.h index cb2b0d794..4f2059c99 100644 --- a/quantum/rgb_matrix_runners/effect_runner_reactive_splash.h +++ b/quantum/rgb_matrix_runners/effect_runner_reactive_splash.h | |||
@@ -2,25 +2,24 @@ | |||
2 | 2 | ||
3 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 3 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
4 | 4 | ||
5 | typedef void (*reactive_splash_f)(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick); | 5 | typedef HSV (*reactive_splash_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick); |
6 | 6 | ||
7 | bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, reactive_splash_f effect_func) { | 7 | bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, reactive_splash_f effect_func) { |
8 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 8 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
9 | 9 | ||
10 | HSV hsv = { 0, rgb_matrix_config.sat, 0 }; | ||
11 | uint8_t count = g_last_hit_tracker.count; | 10 | uint8_t count = g_last_hit_tracker.count; |
12 | for (uint8_t i = led_min; i < led_max; i++) { | 11 | for (uint8_t i = led_min; i < led_max; i++) { |
13 | RGB_MATRIX_TEST_LED_FLAGS(); | 12 | RGB_MATRIX_TEST_LED_FLAGS(); |
14 | hsv.h = rgb_matrix_config.hue; | 13 | HSV hsv = rgb_matrix_config.hsv; |
15 | hsv.v = 0; | 14 | hsv.v = 0; |
16 | for (uint8_t j = start; j < count; j++) { | 15 | for (uint8_t j = start; j < count; j++) { |
17 | int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; | 16 | int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; |
18 | int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; | 17 | int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; |
19 | uint8_t dist = sqrt16(dx * dx + dy * dy); | 18 | uint8_t dist = sqrt16(dx * dx + dy * dy); |
20 | uint16_t tick = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed); | 19 | uint16_t tick = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed); |
21 | effect_func(&hsv, dx, dy, dist, tick); | 20 | hsv = effect_func(hsv, dx, dy, dist, tick); |
22 | } | 21 | } |
23 | hsv.v = scale8(hsv.v, rgb_matrix_config.val); | 22 | hsv.v = scale8(hsv.v, rgb_matrix_config.hsv.v); |
24 | RGB rgb = hsv_to_rgb(hsv); | 23 | RGB rgb = hsv_to_rgb(hsv); |
25 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 24 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
26 | } | 25 | } |
diff --git a/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h b/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h index 54e4c6d86..e68a7a968 100644 --- a/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h +++ b/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h | |||
@@ -1,18 +1,16 @@ | |||
1 | #pragma once | 1 | #pragma once |
2 | 2 | ||
3 | typedef void (*sin_cos_i_f)(HSV* hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time); | 3 | typedef HSV (*sin_cos_i_f)(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time); |
4 | 4 | ||
5 | bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) { | 5 | bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) { |
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.hue, rgb_matrix_config.sat, rgb_matrix_config.val }; | ||
9 | uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); | 8 | uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); |
10 | int8_t cos_value = cos8(time) - 128; | 9 | int8_t cos_value = cos8(time) - 128; |
11 | int8_t sin_value = sin8(time) - 128; | 10 | int8_t sin_value = sin8(time) - 128; |
12 | for (uint8_t i = led_min; i < led_max; i++) { | 11 | for (uint8_t i = led_min; i < led_max; i++) { |
13 | RGB_MATRIX_TEST_LED_FLAGS(); | 12 | RGB_MATRIX_TEST_LED_FLAGS(); |
14 | effect_func(&hsv, cos_value, sin_value, i, time); | 13 | RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); |
15 | RGB rgb = hsv_to_rgb(hsv); | ||
16 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 14 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
17 | } | 15 | } |
18 | return led_max < DRIVER_LED_TOTAL; | 16 | return led_max < DRIVER_LED_TOTAL; |
diff --git a/quantum/rgb_matrix_types.h b/quantum/rgb_matrix_types.h index f890edd94..04a84f4ac 100644 --- a/quantum/rgb_matrix_types.h +++ b/quantum/rgb_matrix_types.h | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | #include <stdint.h> | 3 | #include <stdint.h> |
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include "color.h" | ||
5 | 6 | ||
6 | #if defined(__GNUC__) | 7 | #if defined(__GNUC__) |
7 | #define PACKED __attribute__ ((__packed__)) | 8 | #define PACKED __attribute__ ((__packed__)) |
@@ -81,10 +82,8 @@ typedef union { | |||
81 | struct PACKED { | 82 | struct PACKED { |
82 | uint8_t enable :2; | 83 | uint8_t enable :2; |
83 | uint8_t mode :6; | 84 | uint8_t mode :6; |
84 | uint8_t hue :8; | 85 | HSV hsv; |
85 | uint8_t sat :8; | 86 | uint8_t speed; //EECONFIG needs to be increased to support this |
86 | uint8_t val :8; | ||
87 | uint8_t speed :8;//EECONFIG needs to be increased to support this | ||
88 | }; | 87 | }; |
89 | } rgb_config_t; | 88 | } rgb_config_t; |
90 | 89 | ||
diff --git a/users/xulkal/custom_oled.c b/users/xulkal/custom_oled.c index d871e96f0..7280ef701 100644 --- a/users/xulkal/custom_oled.c +++ b/users/xulkal/custom_oled.c | |||
@@ -80,7 +80,7 @@ static void render_status(void) | |||
80 | oled_set_cursor(0, oled_max_lines() - 7); | 80 | oled_set_cursor(0, oled_max_lines() - 7); |
81 | oled_write_P(PSTR("-----"), false); | 81 | oled_write_P(PSTR("-----"), false); |
82 | static char buffer[26] = {0}; | 82 | static char buffer[26] = {0}; |
83 | snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d\n", rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val, rgb_matrix_config.speed, rgb_matrix_config.mode); | 83 | snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d\n", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, rgb_matrix_config.speed, rgb_matrix_config.mode); |
84 | oled_write(buffer, false); | 84 | oled_write(buffer, false); |
85 | #elif defined(RGBLIGHT_ENABLE) | 85 | #elif defined(RGBLIGHT_ENABLE) |
86 | oled_set_cursor(0, oled_max_lines() - 7); | 86 | oled_set_cursor(0, oled_max_lines() - 7); |
@@ -137,7 +137,7 @@ static void render_status(void) | |||
137 | 137 | ||
138 | #if defined(RGB_MATRIX_ENABLE) | 138 | #if defined(RGB_MATRIX_ENABLE) |
139 | static char buffer[20] = {0}; | 139 | static char buffer[20] = {0}; |
140 | snprintf(buffer, sizeof(buffer), " h%3d s%3d v%3d\n", rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val); | 140 | snprintf(buffer, sizeof(buffer), " h%3d s%3d v%3d\n", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v); |
141 | oled_write(buffer, false); | 141 | oled_write(buffer, false); |
142 | #elif defined(RGBLIGHT_ENABLE) | 142 | #elif defined(RGBLIGHT_ENABLE) |
143 | static char buffer[20] = {0}; | 143 | static char buffer[20] = {0}; |