qmk / qmk_firmware

Open-source keyboard firmware for Atmel AVR and Arm USB families
https://qmk.fm
GNU General Public License v2.0
18.09k stars 38.89k forks source link

[Bug] rgb matrix effect bug. #23850

Closed itarze closed 2 months ago

itarze commented 4 months ago

Describe the Bug

https://github.com/qmk/qmk_firmware/blob/master/quantum/rgb_matrix/animations/pixel_fractal_anim.h

This RGB effect does not limit the NO_LED and will cause access to the wild pointer, which will cause the MCU to malfunction.

Keyboard Used

No response

Link to product page (if applicable)

No response

Operating System

No response

qmk doctor Output

No response

Is AutoHotKey / Karabiner installed

Other keyboard-related software installed

No response

Additional Context

No response

drashna commented 3 months ago

I'm curious which controller this is for. I can't replicate the MCU crash using an STM32F303 (using a moonlander, which does have a bunch of NO_LED values)

jiaxin96 commented 3 months ago

same as https://github.com/qmk/qmk_firmware/pull/23348

itarze commented 2 months ago

I'm curious which controller this is for. I can't replicate the MCU crash using an STM32F303 (using a moonlander, which does have a bunch of NO_LED values)

Set NO LED to the left half of the keyboard RGB MATRIX, Like this.

image
itarze commented 2 months ago

And, This will slove it. Maybe not the best solution.

void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
    if (index >= RGB_MATRIX_LED_COUNT) {
        return;
    }
    rgb_matrix_driver.set_color(index, red, green, blue);
}
itarze commented 2 months ago

This problem was generated randomly because this lamp effect used random8(), and it may be that you were not able to reproduce it for this reason.