diff --git a/right/src/keymap.c b/right/src/keymap.c index 6337101..ef04bd2 100644 --- a/right/src/keymap.c +++ b/right/src/keymap.c @@ -5,7 +5,6 @@ #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] = { { @@ -25,7 +24,6 @@ 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 f2a9424..c5f8022 100644 --- a/right/src/usb_report_updater.c +++ b/right/src/usb_report_updater.c @@ -25,8 +25,7 @@ static uint16_t DoubleTapSwitchLayerReleaseTimeout = 200; static bool activeMouseStates[ACTIVE_MOUSE_STATES_COUNT]; bool TestUsbStack = false; -bool KeymapChanged = false; -static uint8_t layerCache[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE]; +static key_action_t actionCache[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE]; volatile uint8_t UsbReportUpdateSemaphore = 0; @@ -335,8 +334,6 @@ static void updateActiveUsbReports(void) if (layerChanged) { stickyModifiers = 0; } - bool keymapChangedLastCycle = KeymapChanged; - KeymapChanged = false; LedDisplay_SetLayer(activeLayer); if (TestUsbStack) { @@ -383,16 +380,14 @@ static void updateActiveUsbReports(void) secondaryRoleState = SecondaryRoleState_Triggered; keyState->current = false; } else { - layerCache[slotId][keyId] = activeLayer; + actionCache[slotId][keyId] = CurrentKeymap[activeLayer][slotId][keyId]; } } - action = &CurrentKeymap[layerCache[slotId][keyId]][slotId][keyId]; + action = &actionCache[slotId][keyId]; if (keyState->current) { - if ((KeymapChanged || keymapChangedLastCycle) && keyState->previous) { - keyState->suppressed = true; - } else if (action->type == KeyActionType_Keystroke && action->keystroke.secondaryRole) { + if (action->type == KeyActionType_Keystroke && action->keystroke.secondaryRole) { // Press released secondary role key. if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Released) { secondaryRoleState = SecondaryRoleState_Pressed; diff --git a/right/src/usb_report_updater.h b/right/src/usb_report_updater.h index 02ed725..493b2b4 100644 --- a/right/src/usb_report_updater.h +++ b/right/src/usb_report_updater.h @@ -74,7 +74,6 @@ extern uint32_t UsbReportUpdateCounter; extern volatile uint8_t UsbReportUpdateSemaphore; extern bool TestUsbStack; - extern bool KeymapChanged; // Functions: