Reset modifier states when keymap is reset

- asdf.c: remove asdf_modifiers_init() from asdf_init().
- asdf_keymaps.c: add a call do asdf_modifiers_init()
  to asdf_keymaps_select_keymap()
This commit is contained in:
David Fenyes 2020-03-21 14:26:57 -05:00
parent 3cd9547d59
commit e37da4e969
2 changed files with 6 additions and 4 deletions

View File

@ -374,9 +374,8 @@ void asdf_init(void)
last_key = ACTION_NOTHING; last_key = ACTION_NOTHING;
asdf_modifiers_init();
asdf_repeat_init(); asdf_repeat_init();
asdf_keymaps_init(); asdf_keymaps_init(); // also initializes modifier states.
asdf_buffer_init(); asdf_buffer_init();
// reserve a buffer: // reserve a buffer:

View File

@ -56,8 +56,10 @@ static uint8_t keymap_index;
// OUTPUTS: none // OUTPUTS: none
// //
// DESCRIPTION: accepts a index value. If the requested keymap index is valid, // DESCRIPTION: accepts a index value. If the requested keymap index is valid,
// then assign the value to the global (to the module) keymap_index variable, // then:
// and initialize the virtual outputs for the selected keymap. // 1) assign the value to the global (to the module) keymap_index variable
// 2) initialize the virtual outputs for the selected keymap.
// 3) initialize the modifier key states.
// //
// SIDE EFFECTS: May change the module-global keymap_index variable. // SIDE EFFECTS: May change the module-global keymap_index variable.
// //
@ -72,6 +74,7 @@ void asdf_keymaps_select_keymap(uint8_t index)
if (index < ASDF_NUM_KEYMAPS) { if (index < ASDF_NUM_KEYMAPS) {
keymap_index = index; keymap_index = index;
asdf_virtual_init((asdf_virtual_initializer_t *const) keymap_initializer_list[keymap_index]); asdf_virtual_init((asdf_virtual_initializer_t *const) keymap_initializer_list[keymap_index]);
asdf_modifiers_init();
} }
} }