Fix x5_ansi_red (WestBerry)

This commit is contained in:
KeychronMacro 2024-01-26 14:08:03 +08:00
parent bd24838217
commit 196ac9dd07
2 changed files with 18 additions and 3 deletions

View File

@ -111,11 +111,15 @@ void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t c
} }
uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column) { uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column) {
uint16_t keycode_temp;
if (layer >= DYNAMIC_KEYMAP_LAYER_COUNT || row >= MATRIX_ROWS || column >= MATRIX_COLS) return KC_NO; if (layer >= DYNAMIC_KEYMAP_LAYER_COUNT || row >= MATRIX_ROWS || column >= MATRIX_COLS) return KC_NO;
void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column); void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column);
// Big endian, so we can read/write EEPROM directly from host if we want // Big endian, so we can read/write EEPROM directly from host if we want
uint16_t keycode = eeprom_read_byte(address) << 8; /*uint16_t keycode = eeprom_read_byte(address) << 8;
keycode |= eeprom_read_byte(address + 1); keycode |= eeprom_read_byte(address + 1);*/
keycode_temp=eeprom_read_word(address);
uint16_t keycode=((keycode_temp&0XFF)<<8)|((keycode_temp>>8)&0XFF);
return keycode; return keycode;
} }

View File

@ -194,8 +194,19 @@ action_t action_for_keycode(uint16_t keycode) {
// translates key to keycode // translates key to keycode
__attribute__((weak)) uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) { __attribute__((weak)) uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) {
static uint8_t layerTemp=0xFF;
static uint8_t rowTemp=0xFF;
static uint8_t colTemp=0xFF;
static uint16_t keycodeTemp=0;
if (key.row < MATRIX_ROWS && key.col < MATRIX_COLS) { if (key.row < MATRIX_ROWS && key.col < MATRIX_COLS) {
return keycode_at_keymap_location(layer, key.row, key.col); if( (layer!=layerTemp) || (key.row!=rowTemp) || (key.col!=colTemp) )
{
layerTemp=layer;rowTemp=key.row;colTemp=key.col;
keycodeTemp=keycode_at_keymap_location(layer, key.row, key.col);
}
return keycodeTemp;
//return keycode_at_keymap_location(layer, key.row, key.col);
} }
#ifdef ENCODER_MAP_ENABLE #ifdef ENCODER_MAP_ENABLE
else if (key.row == KEYLOC_ENCODER_CW && key.col < NUM_ENCODERS) { else if (key.row == KEYLOC_ENCODER_CW && key.col < NUM_ENCODERS) {