From 01477b7ef2536d2c615d3e92a803cf6d52455fa6 Mon Sep 17 00:00:00 2001 From: tmk Date: Mon, 3 Feb 2020 12:36:26 +0900 Subject: [PATCH] core: Fix unimap translation range --- tmk_core/common/unimap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tmk_core/common/unimap.c b/tmk_core/common/unimap.c index 84109b5a..fcdc93bd 100644 --- a/tmk_core/common/unimap.c +++ b/tmk_core/common/unimap.c @@ -25,8 +25,8 @@ keypos_t unimap_translate(keypos_t key) unimap_trans[key.row][key.col]; #endif return (keypos_t) { - .row = ((unimap_pos & 0xf0) >> 4), - .col = (unimap_pos & 0x0f) + .row = ((unimap_pos >> 4 ) & 0x07), + .col = (unimap_pos & 0x0F) }; } @@ -35,13 +35,13 @@ __attribute__ ((weak)) action_t action_for_key(uint8_t layer, keypos_t key) { keypos_t uni = unimap_translate(key); - if ((uni.row << 4 | uni.col) == UNIMAP_NO) { + if ((uni.row << 4 | uni.col) > 0x7F) { return (action_t)ACTION_NO; } #if defined(__AVR__) - return (action_t)pgm_read_word(&actionmaps[(layer)][(uni.row & 0x7)][(uni.col)]); + return (action_t)pgm_read_word(&actionmaps[(layer)][(uni.row & 0x07)][(uni.col & 0x0F)]); #else - return actionmaps[(layer)][(uni.row & 0x7)][(uni.col)]; + return actionmaps[(layer)][(uni.row & 0x07)][(uni.col & 0x0F)]; #endif } -- 2.46.0