Tweak the logic of the USB stack test
This commit is contained in:
@@ -323,24 +323,23 @@ static void updateActiveUsbReports(void)
|
||||
bool layerGotReleased = previousLayer != LayerId_Base && activeLayer == LayerId_Base;
|
||||
LedDisplay_SetLayer(activeLayer);
|
||||
|
||||
static bool simulateKeypresses = false;
|
||||
static bool isEven = false;
|
||||
static bool isEvenMedia = false;
|
||||
static uint32_t mediaCounter = 0;
|
||||
if (TestUsbStack) {
|
||||
static bool simulateKeypresses, isEven, isEvenMedia;
|
||||
static uint32_t mediaCounter = 0;
|
||||
key_state_t *testKeyState = &KeyStates[SlotId_LeftKeyboardHalf][0];
|
||||
|
||||
key_state_t *testKeyState = &KeyStates[SlotId_LeftKeyboardHalf][0];
|
||||
if (TestUsbStack && !testKeyState->previous && testKeyState->current && activeLayer == LayerId_Fn) {
|
||||
simulateKeypresses = !simulateKeypresses;
|
||||
}
|
||||
|
||||
if (simulateKeypresses) {
|
||||
isEven = !isEven;
|
||||
ActiveUsbBasicKeyboardReport->scancodes[basicScancodeIndex++] = isEven ? HID_KEYBOARD_SC_A : HID_KEYBOARD_SC_BACKSPACE;
|
||||
if (++mediaCounter % 200 == 0) {
|
||||
isEvenMedia = !isEvenMedia;
|
||||
ActiveUsbMediaKeyboardReport->scancodes[mediaScancodeIndex++] = isEvenMedia ? MEDIA_VOLUME_DOWN : MEDIA_VOLUME_UP;
|
||||
if (activeLayer == LayerId_Fn && testKeyState->current && !testKeyState->previous) {
|
||||
simulateKeypresses = !simulateKeypresses;
|
||||
}
|
||||
if (simulateKeypresses) {
|
||||
isEven = !isEven;
|
||||
ActiveUsbBasicKeyboardReport->scancodes[basicScancodeIndex++] = isEven ? HID_KEYBOARD_SC_A : HID_KEYBOARD_SC_BACKSPACE;
|
||||
if (++mediaCounter % 200 == 0) {
|
||||
isEvenMedia = !isEvenMedia;
|
||||
ActiveUsbMediaKeyboardReport->scancodes[mediaScancodeIndex++] = isEvenMedia ? MEDIA_VOLUME_DOWN : MEDIA_VOLUME_UP;
|
||||
}
|
||||
MouseMoveState.xOut = isEven ? -1 : 1;
|
||||
}
|
||||
MouseMoveState.xOut = isEven ? -1 : 1;
|
||||
}
|
||||
|
||||
for (uint8_t slotId=0; slotId<SLOT_COUNT; slotId++) {
|
||||
|
||||
Reference in New Issue
Block a user