From dc5befd13906f193f6ee8c2f9ace01100a167b20 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sat, 16 Dec 2023 15:43:39 +0000 Subject: [PATCH] Remove redundant RGB/LED matrix eeconfig init (#22673) --- quantum/led_matrix/led_matrix.c | 16 ++++++++++------ quantum/led_matrix/led_matrix.h | 2 ++ quantum/rgb_matrix/rgb_matrix.c | 6 ------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c index 4699c4a4c2..eee43d9281 100644 --- a/quantum/led_matrix/led_matrix.c +++ b/quantum/led_matrix/led_matrix.c @@ -111,6 +111,16 @@ void eeconfig_debug_led_matrix(void) { dprintf("led_matrix_eeconfig.flags = %d\n", led_matrix_eeconfig.flags); } +void led_matrix_reload_from_eeprom(void) { + led_matrix_disable_noeeprom(); + /* Reset back to what we have in eeprom */ + eeconfig_init_led_matrix(); + eeconfig_debug_led_matrix(); // display current eeprom values + if (led_matrix_eeconfig.enable) { + led_matrix_mode_noeeprom(led_matrix_eeconfig.mode); + } +} + __attribute__((weak)) uint8_t led_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { return 0; } @@ -415,12 +425,6 @@ void led_matrix_init(void) { } #endif // LED_MATRIX_KEYREACTIVE_ENABLED - if (!eeconfig_is_enabled()) { - dprintf("led_matrix_init_drivers eeconfig is not enabled.\n"); - eeconfig_init(); - eeconfig_update_led_matrix_default(); - } - eeconfig_init_led_matrix(); if (!led_matrix_eeconfig.mode) { dprintf("led_matrix_init_drivers led_matrix_eeconfig.mode = 0. Write default values to EEPROM.\n"); diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h index 153abf2975..eeaeee20b5 100644 --- a/quantum/led_matrix/led_matrix.h +++ b/quantum/led_matrix/led_matrix.h @@ -136,6 +136,8 @@ bool led_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max); void led_matrix_init(void); +void led_matrix_reload_from_eeprom(void); + void led_matrix_set_suspend_state(bool state); bool led_matrix_get_suspend_state(void); void led_matrix_toggle(void); diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c index ebaf3077dc..fb7f20c210 100644 --- a/quantum/rgb_matrix/rgb_matrix.c +++ b/quantum/rgb_matrix/rgb_matrix.c @@ -460,12 +460,6 @@ void rgb_matrix_init(void) { } #endif // RGB_MATRIX_KEYREACTIVE_ENABLED - if (!eeconfig_is_enabled()) { - dprintf("rgb_matrix_init_drivers eeconfig is not enabled.\n"); - eeconfig_init(); - eeconfig_update_rgb_matrix_default(); - } - eeconfig_init_rgb_matrix(); if (!rgb_matrix_config.mode) { dprintf("rgb_matrix_init_drivers rgb_matrix_config.mode = 0. Write default values to EEPROM.\n");