diff --git a/quantum/dynamic_keymap.c b/quantum/dynamic_keymap.c index 69693ad7a5..b9863468c8 100644 --- a/quantum/dynamic_keymap.c +++ b/quantum/dynamic_keymap.c @@ -200,7 +200,7 @@ uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) { #endif #ifdef VIAL_ENCODERS_ENABLE - if (key.row == 254 && key.col == 254) + if (key.row == VIAL_ENCODER_MATRIX_MAGIC && key.col == VIAL_ENCODER_MATRIX_MAGIC) return g_vial_magic_keycode_override; #endif diff --git a/quantum/vial.c b/quantum/vial.c index 1edf5e8579..8499e0a150 100644 --- a/quantum/vial.c +++ b/quantum/vial.c @@ -163,10 +163,10 @@ static void exec_keycode(uint16_t keycode) { g_vial_magic_keycode_override = keycode; action_exec((keyevent_t){ - .key = (keypos_t){.row = 254, .col = 254}, .pressed = 1, .time = (timer_read() | 1) /* time should not be 0 */ + .key = (keypos_t){.row = VIAL_ENCODER_MATRIX_MAGIC, .col = VIAL_ENCODER_MATRIX_MAGIC}, .pressed = 1, .time = (timer_read() | 1) /* time should not be 0 */ }); action_exec((keyevent_t){ - .key = (keypos_t){.row = 254, .col = 254}, .pressed = 0, .time = (timer_read() | 1) /* time should not be 0 */ + .key = (keypos_t){.row = VIAL_ENCODER_MATRIX_MAGIC, .col = VIAL_ENCODER_MATRIX_MAGIC}, .pressed = 0, .time = (timer_read() | 1) /* time should not be 0 */ }); } diff --git a/quantum/vial.h b/quantum/vial.h index 74163a23cd..be12ea2ede 100644 --- a/quantum/vial.h +++ b/quantum/vial.h @@ -41,3 +41,6 @@ enum { vial_unlock_poll = 0x07, vial_lock = 0x08, }; + +/* Fake encoder position in keyboard matrix, can't use 255 as that is immediately rejected by IS_NOEVENT */ +#define VIAL_ENCODER_MATRIX_MAGIC 254