From e37da4e969e4cf0ef26199b8bda68f057705f2f7 Mon Sep 17 00:00:00 2001 From: David Fenyes Date: Sat, 21 Mar 2020 14:26:57 -0500 Subject: [PATCH] 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() --- firmware/asdf/src/asdf.c | 3 +-- firmware/asdf/src/asdf_keymaps.c | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/firmware/asdf/src/asdf.c b/firmware/asdf/src/asdf.c index 353ab36..24a619e 100644 --- a/firmware/asdf/src/asdf.c +++ b/firmware/asdf/src/asdf.c @@ -374,9 +374,8 @@ void asdf_init(void) last_key = ACTION_NOTHING; - asdf_modifiers_init(); asdf_repeat_init(); - asdf_keymaps_init(); + asdf_keymaps_init(); // also initializes modifier states. asdf_buffer_init(); // reserve a buffer: diff --git a/firmware/asdf/src/asdf_keymaps.c b/firmware/asdf/src/asdf_keymaps.c index 7f0aa0e..5611961 100644 --- a/firmware/asdf/src/asdf_keymaps.c +++ b/firmware/asdf/src/asdf_keymaps.c @@ -56,8 +56,10 @@ static uint8_t keymap_index; // OUTPUTS: none // // 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, -// and initialize the virtual outputs for the selected keymap. +// then: +// 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. // @@ -72,6 +74,7 @@ void asdf_keymaps_select_keymap(uint8_t index) if (index < ASDF_NUM_KEYMAPS) { keymap_index = index; asdf_virtual_init((asdf_virtual_initializer_t *const) keymap_initializer_list[keymap_index]); + asdf_modifiers_init(); } }