diff --git a/right/src/usb_report_updater.c b/right/src/usb_report_updater.c index ef3b229da..f2a9424c6 100644 --- a/right/src/usb_report_updater.c +++ b/right/src/usb_report_updater.c @@ -440,14 +440,21 @@ uint32_t UsbReportUpdateCounter; void UpdateUsbReports(void) { + static uint32_t lastUpdateTime; + for (uint8_t keyId = 0; keyId < RIGHT_KEY_MATRIX_KEY_COUNT; keyId++) { KeyStates[SlotId_RightKeyboardHalf][keyId].current = RightKeyMatrix.keyStates[keyId]; } if (UsbReportUpdateSemaphore && !SleepModeActive) { - return; + if (Timer_GetElapsedTime(&lastUpdateTime) < USB_SEMAPHORE_TIMEOUT) { + return; + } else { + UsbReportUpdateSemaphore = 0; + } } + lastUpdateTime = CurrentTime; UsbReportUpdateCounter++; ResetActiveUsbBasicKeyboardReport(); diff --git a/right/src/usb_report_updater.h b/right/src/usb_report_updater.h index d3df70ba7..02ed725bf 100644 --- a/right/src/usb_report_updater.h +++ b/right/src/usb_report_updater.h @@ -14,6 +14,8 @@ #define SECONDARY_ROLE_MODIFIER_TO_HID_MODIFIER(secondaryRoleModifier) (1 << ((secondaryRoleModifier) - 1)) #define SECONDARY_ROLE_LAYER_TO_LAYER_ID(secondaryRoleLayer) ((secondaryRoleLayer) - SecondaryRole_RightSuper) + #define USB_SEMAPHORE_TIMEOUT 100 // ms + // Typedefs: typedef enum {