From c0aca9f45cce70d590f8644374b957b0161eaabc Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 14 Jul 2024 06:38:04 +0100 Subject: [PATCH] Various fixes for keyboards not implementing callbacks correctly (#24116) --- keyboards/cipulot/ec_980c/ec_980c.c | 4 ++++ keyboards/cipulot/ec_typek/ec_typek.c | 6 ++++-- keyboards/clueboard/2x1800/2019/2019.c | 5 +---- keyboards/clueboard/2x1800/2019/2019.h | 3 --- keyboards/clueboard/2x1800/2021/2021.c | 7 +------ keyboards/converter/ibm_terminal/led.c | 22 +++++++++++----------- keyboards/jukaie/jk01/jk01.c | 8 ++++---- keyboards/mechlovin/zed1800/zed1800.c | 8 +++++--- 8 files changed, 30 insertions(+), 33 deletions(-) diff --git a/keyboards/cipulot/ec_980c/ec_980c.c b/keyboards/cipulot/ec_980c/ec_980c.c index 2b40d5a5e6..0e23c32335 100644 --- a/keyboards/cipulot/ec_980c/ec_980c.c +++ b/keyboards/cipulot/ec_980c/ec_980c.c @@ -86,6 +86,10 @@ void keyboard_post_init_kb(void) { * Num | Caps | Scroll | */ bool rgb_matrix_indicators_kb(void) { + if (!rgb_matrix_indicators_user()) { + return false; + } + if (eeprom_ec_config.num.enabled) { // The rgb_matrix_set_color function needs an RGB code to work, so first the indicator color is cast to an HSV value and then translated to RGB HSV hsv_num_indicator_color = {eeprom_ec_config.num.h, eeprom_ec_config.num.s, eeprom_ec_config.num.v}; diff --git a/keyboards/cipulot/ec_typek/ec_typek.c b/keyboards/cipulot/ec_typek/ec_typek.c index d8e0f9236e..b899ddbb8a 100644 --- a/keyboards/cipulot/ec_typek/ec_typek.c +++ b/keyboards/cipulot/ec_typek/ec_typek.c @@ -82,12 +82,14 @@ void keyboard_post_init_kb(void) { // This function gets called when caps, num, scroll change bool led_update_kb(led_t led_state) { - indicators_callback(); + if(led_update_user(led_state)) { + indicators_callback(); + } return true; } // This function is called when layers change -layer_state_t layer_state_set_user(layer_state_t state) { +__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { indicators_callback(); return state; } diff --git a/keyboards/clueboard/2x1800/2019/2019.c b/keyboards/clueboard/2x1800/2019/2019.c index 3fe170af99..5910ca61e9 100644 --- a/keyboards/clueboard/2x1800/2019/2019.c +++ b/keyboards/clueboard/2x1800/2019/2019.c @@ -130,11 +130,8 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { return process_record_user(keycode, record); } -__attribute__((weak)) bool encoder_update_keymap(uint8_t index, bool clockwise) { return true; } -__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { return encoder_update_keymap(index, clockwise); } - bool encoder_update_kb(uint8_t index, bool clockwise) { - if (!encoder_update_user(index, clockwise)) { + if (encoder_update_user(index, clockwise)) { // Encoder 1, outside left if (index == 0 && clockwise) { tap_code(KC_MS_U); // turned right diff --git a/keyboards/clueboard/2x1800/2019/2019.h b/keyboards/clueboard/2x1800/2019/2019.h index c5869ff66f..d5867dacac 100644 --- a/keyboards/clueboard/2x1800/2019/2019.h +++ b/keyboards/clueboard/2x1800/2019/2019.h @@ -24,8 +24,5 @@ enum TWOx1800_keycodes { ENC_BTN4, }; -// Encoder update function that returns true/false -bool encoder_update_keymap(uint8_t index, bool clockwise); - // Encoder button combo check void check_encoder_buttons(void); diff --git a/keyboards/clueboard/2x1800/2021/2021.c b/keyboards/clueboard/2x1800/2021/2021.c index 5274f76e9c..d140c1cf15 100644 --- a/keyboards/clueboard/2x1800/2021/2021.c +++ b/keyboards/clueboard/2x1800/2021/2021.c @@ -96,16 +96,11 @@ void matrix_init_kb(void) { matrix_init_user(); } -__attribute__ ((weak)) -bool encoder_update_keymap(int8_t index, bool clockwise) { - return false; -} - #define NUM_COLUMNS 8*MAX7219_CONTROLLERS uint8_t led_position[2] = {0,0}; // The location of the cursor in the matrix bool encoder_update_kb(uint8_t index, bool clockwise) { - if (!encoder_update_keymap(index, clockwise)) { + if (encoder_update_user(index, clockwise)) { #if defined(DRAWING_TOY_MODE) // Encoder 1, left if (index == 0 && clockwise) { diff --git a/keyboards/converter/ibm_terminal/led.c b/keyboards/converter/ibm_terminal/led.c index 1bcde277a2..1639388ff9 100644 --- a/keyboards/converter/ibm_terminal/led.c +++ b/keyboards/converter/ibm_terminal/led.c @@ -19,16 +19,16 @@ along with this program. If not, see . #include "ps2.h" #include "led.h" - -bool led_update_kb(led_t led_state) -{ - uint8_t ps2_led = 0; - if (led_state.scroll_lock) - ps2_led |= (1<