qmk / qmk_firmware

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

[Bug] Cannot control RGB Matrix manually, colors repeatedly overwritten with solid color under RGB_MATRIX_NONE mode #14686

Open Myridium opened 2 years ago

Myridium commented 2 years ago

Describe the Bug

The RGB matrix mode RGB_MATRIX_NONE interferes with manual RGB control. Unable to set RGB states manually.

Setting rgb_matrix_mode(RGB_MATRIX_NONE); results in a constant red colour under every key. When I set an LED color using rgb_matrix_set_color, the new color setting applies for an instant before being overwritten again by the red colour. This makes it impossible to control the LEDs manually.

Myridium commented 2 years ago

Investingating a bit more, I have found that rgb_matrix_mode(RGB_MATRIX_NONE) actually sets the matrix mode to RGB_MATRIX_SOLID_COLOR instead. The output of rgb_matrix_get_mode() shows that the mode was not set to 0 but 1 instead.

drashna commented 2 years ago

The "none" mode is special and is meant only to be used internally. Using rgb_matrix_mode will ensure that it is not used, and that the solid color mode is used instead.

Myridium commented 2 years ago

The "none" mode is special and is meant only to be used internally. Using rgb_matrix_mode will ensure that it is not used, and that the solid color mode is used instead.

There's nothing I found in the QMK documentation to explain what the roles of the different matrix modes are, so naturally I assumed that RGB_MATRIX_NONE meant no lighting-- e.g. do not control the LEDs on the board automatically. Then I expected to be able to control them manually.

Perhaps this should be taken as an issue with the documentation clarity.

FrodoSynthesis05 commented 2 years ago

I just ran into the exact same bug with a crkbd using the gotham keymap variant. So far the fixes mentioned on the thread have not worked.

atomgomba commented 2 years ago

Yes, the RGB_MATRIX_NONE mode is misleading and it seems it is not well documented. I'm also trying to disable automatic lighting while keeping manual control enabled and I tried this instead to no avail:

void keyboard_post_init_user(void) {
    rgb_matrix_enable_noeeprom();
    rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR);
    rgb_matrix_set_color_all(RGB_OFF);
}

There is still a red underglow right after boot. The only way to get rid of the automatic lights is to use defines:

#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR
#define RGB_MATRIX_STARTUP_HUE 0
#define RGB_MATRIX_STARTUP_SAT 0
#define RGB_MATRIX_STARTUP_VAL 0
JFT70 commented 2 years ago

Out of curiosity on which keyboard does this occur?

atomgomba commented 2 years ago

@JFT70 This one has a SN32F248B chip (Sonix)

drashna commented 2 years ago

@atomgomba are you using rgb_matrix_indicators_user for setting the leds individually, or?

atomgomba commented 2 years ago

@drashna Yes, I set the color of some individual keys in rgb_matrix_indicators_kb and this was my motivation to disable the automatic lighting effect

tcteo commented 12 months ago

I ran into this as well, but managed a hacky workaround by defining a custom rgb_matrix effect that does nothing (example). Is there a better way to select no-effect, without entirely disabling rgb_matrix, so we can do manual control?

drashna commented 11 months ago

set the flags to "none".