Various fixes for keyboards not implementing callbacks correctly (#24116)
This commit is contained in:
parent
e76069ea4e
commit
c0aca9f45c
@ -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};
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -19,16 +19,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#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<<PS2_LED_SCROLL_LOCK);
|
||||
if (led_state.num_lock)
|
||||
ps2_led |= (1<<PS2_LED_NUM_LOCK);
|
||||
if (led_state.caps_lock)
|
||||
ps2_led |= (1<<PS2_LED_CAPS_LOCK);
|
||||
ps2_host_set_led(ps2_led);
|
||||
bool led_update_kb(led_t led_state) {
|
||||
if(led_update_user(led_state)) {
|
||||
uint8_t ps2_led = 0;
|
||||
if (led_state.scroll_lock)
|
||||
ps2_led |= (1<<PS2_LED_SCROLL_LOCK);
|
||||
if (led_state.num_lock)
|
||||
ps2_led |= (1<<PS2_LED_NUM_LOCK);
|
||||
if (led_state.caps_lock)
|
||||
ps2_led |= (1<<PS2_LED_CAPS_LOCK);
|
||||
ps2_host_set_led(ps2_led);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -155,7 +155,8 @@ void housekeeping_task_kb(void) {
|
||||
gpio_write_pin(C15, keymap_config.no_gui);
|
||||
};
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
if (!process_record_user(keycode, record)) { return false; }
|
||||
|
||||
switch (keycode) {
|
||||
|
||||
@ -166,8 +167,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
host_consumer_send(0);
|
||||
}
|
||||
return false; /* Skip all further processing of this key */
|
||||
|
||||
default:
|
||||
return true; /* Process all other keycodes normally */
|
||||
}
|
||||
|
||||
return true; /* Process all other keycodes normally */
|
||||
};
|
@ -36,8 +36,10 @@ void keyboard_post_init_kb(void) {
|
||||
|
||||
// Activate rgb layer for caps when capslock is enabled
|
||||
bool led_update_kb(led_t led_state) {
|
||||
rgblight_set_layer_state(0, led_state.caps_lock);
|
||||
rgblight_set_layer_state(1, led_state.num_lock);
|
||||
rgblight_set_layer_state(2, led_state.scroll_lock);
|
||||
if(led_update_user(led_state)) {
|
||||
rgblight_set_layer_state(0, led_state.caps_lock);
|
||||
rgblight_set_layer_state(1, led_state.num_lock);
|
||||
rgblight_set_layer_state(2, led_state.scroll_lock);
|
||||
}
|
||||
return true;
|
||||
}
|
Loading…
Reference in New Issue
Block a user