Fix FORCE_NKRO handling (#7601)

This commit is contained in:
Joel Challis 2019-12-11 19:39:30 +00:00 committed by Drashna Jaelre
parent 071eb2478f
commit efb21c00ce
2 changed files with 135 additions and 132 deletions

View file

@ -39,10 +39,10 @@ float cg_swap_song[][2] = CG_SWAP_SONG;
*/
bool process_magic(uint16_t keycode, keyrecord_t *record) {
// skip anything that isn't a keyup
if (!record->event.pressed) {
return true;
}
if (record->event.pressed) {
switch (keycode) {
case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_ALT_GUI:
case MAGIC_SWAP_LCTL_LGUI ... MAGIC_EE_HANDS_RIGHT:
/* keymap config */
keymap_config.raw = eeconfig_read_keymap();
switch (keycode) {
@ -164,13 +164,15 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
case MAGIC_EE_HANDS_RIGHT:
eeconfig_update_handedness(false);
break;
default:
// Not a magic keycode so continue processing
return true;
}
eeconfig_update_keymap(keymap_config.raw);
clear_keyboard(); // clear to prevent stuck keys
return false;
}
}
// Not a magic keycode so continue processing
return true;
}

View file

@ -254,6 +254,7 @@ void keyboard_init(void) {
#endif
#if defined(NKRO_ENABLE) && defined(FORCE_NKRO)
keymap_config.nkro = 1;
eeconfig_update_keymap(keymap_config.raw);
#endif
keyboard_post_init_kb(); /* Always keep this last */
}