From ddde988d0a44519b08775272ad4cbec457c29fe0 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sun, 20 Sep 2026 13:33:08 -0700 Subject: [PATCH] Fix Fractal Pixel animation (#26463) This change does two things: * Rounds up instead of down, so that a low count check isn't needed. * When the matrix col is odd, by rounding up, and checking if the right and left indices are the same, skip one since we don't need to process the same column twice. --- quantum/rgb_matrix/animations/pixel_fractal_anim.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/quantum/rgb_matrix/animations/pixel_fractal_anim.h b/quantum/rgb_matrix/animations/pixel_fractal_anim.h index 05d899f6ec2..240d938bfd8 100644 --- a/quantum/rgb_matrix/animations/pixel_fractal_anim.h +++ b/quantum/rgb_matrix/animations/pixel_fractal_anim.h @@ -6,12 +6,8 @@ RGB_MATRIX_EFFECT(PIXEL_FRACTAL) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS -static bool PIXEL_FRACTAL(effect_params_t* params) { -# if MATRIX_COLS < 2 -# define MID_COL 1 -# else -# define MID_COL (MATRIX_COLS / 2) -# endif +static bool PIXEL_FRACTAL(effect_params_t *params) { +# define MID_COL ((MATRIX_COLS + 1) / 2) static bool led[MATRIX_ROWS][MID_COL]; static uint32_t wait_timer = 0; @@ -33,7 +29,7 @@ static bool PIXEL_FRACTAL(effect_params_t* params) { if (l_idx >= led_min && l_idx < led_max && HAS_ANY_FLAGS(g_led_config.flags[l_idx], params->flags)) { rgb_matrix_set_color(l_idx, index_rgb.r, index_rgb.g, index_rgb.b); } - if (r_idx >= led_min && r_idx < led_max && HAS_ANY_FLAGS(g_led_config.flags[r_idx], params->flags)) { + if (r_idx >= led_min && r_idx < led_max && HAS_ANY_FLAGS(g_led_config.flags[r_idx], params->flags) && r_idx != l_idx) { rgb_matrix_set_color(r_idx, index_rgb.r, index_rgb.g, index_rgb.b); } }