diff --git a/right/src/keymap.c b/right/src/keymap.c index ef04bd2..6337101 100644 --- a/right/src/keymap.c +++ b/right/src/keymap.c @@ -5,6 +5,7 @@ #include "config_parser/parse_keymap.h" #include "config_parser/config_globals.h" #include "macros.h" +#include "usb_report_updater.h" keymap_reference_t AllKeymaps[MAX_KEYMAP_NUM] = { { @@ -24,6 +25,7 @@ void SwitchKeymapById(uint8_t index) ValidatedUserConfigBuffer.offset = AllKeymaps[index].offset; ParseKeymap(&ValidatedUserConfigBuffer, index, AllKeymapsCount, AllMacrosCount); LedDisplay_UpdateText(); + KeymapChanged = true; } bool SwitchKeymapByAbbreviation(uint8_t length, char *abbrev) diff --git a/right/src/usb_report_updater.c b/right/src/usb_report_updater.c index c3b7749..d0ae32a 100644 --- a/right/src/usb_report_updater.c +++ b/right/src/usb_report_updater.c @@ -25,6 +25,7 @@ static uint16_t DoubleTapSwitchLayerReleaseTimeout = 200; static bool activeMouseStates[ACTIVE_MOUSE_STATES_COUNT]; bool TestUsbStack = false; +bool KeymapChanged = false; volatile uint8_t UsbReportUpdateSemaphore = 0; @@ -333,7 +334,6 @@ static void updateActiveUsbReports(void) if (layerChanged) { stickyModifiers = 0; } - bool layerGotReleased = layerChanged && activeLayer == LayerId_Base; LedDisplay_SetLayer(activeLayer); if (TestUsbStack) { @@ -376,7 +376,7 @@ static void updateActiveUsbReports(void) WakeUpHost(); } key_action_t *baseAction = &CurrentKeymap[LayerId_Base][slotId][keyId]; - if (layerGotReleased && !(baseAction->type == KeyActionType_Keystroke && baseAction->keystroke.scancode == 0 && baseAction->keystroke.modifiers)) { + if ((layerChanged || KeymapChanged) && !(baseAction->type == KeyActionType_Keystroke && baseAction->keystroke.scancode == 0 && baseAction->keystroke.modifiers)) { keyState->suppressed = true; } @@ -427,6 +427,7 @@ static void updateActiveUsbReports(void) } previousLayer = activeLayer; + KeymapChanged = false; } uint32_t UsbReportUpdateCounter; diff --git a/right/src/usb_report_updater.h b/right/src/usb_report_updater.h index bbdc507..d3df70b 100644 --- a/right/src/usb_report_updater.h +++ b/right/src/usb_report_updater.h @@ -72,6 +72,7 @@ extern uint32_t UsbReportUpdateCounter; extern volatile uint8_t UsbReportUpdateSemaphore; extern bool TestUsbStack; + extern bool KeymapChanged; // Functions: