From be49df280679f6dfb173350bef36e8612ac980f6 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 24 Nov 2017 18:04:53 +0100 Subject: [PATCH] Fix ConsumerControl repeating Instead of sending a press & release for the consumer key when the physical key is released, send a press each cycle it is held, a report along with the keyboard report, and clear the consumer report each cycle too. This will prevent these keys getting stuck, or sending multiple presses in the same report. Fixes #176. Signed-off-by: Gergely Nagy --- src/kaleidoscope/hid.cpp | 2 ++ src/key_events.cpp | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/kaleidoscope/hid.cpp b/src/kaleidoscope/hid.cpp index 7d6e88a9..819ae75f 100644 --- a/src/kaleidoscope/hid.cpp +++ b/src/kaleidoscope/hid.cpp @@ -63,6 +63,7 @@ void releaseRawKey(Key mappedKey) { void releaseAllKeys() { Keyboard.releaseAll(); + ConsumerControl.releaseAll(); } void releaseKey(Key mappedKey) { @@ -99,6 +100,7 @@ uint8_t getKeyboardLEDs() { void sendKeyboardReport() { Keyboard.sendReport(); + ConsumerControl.sendReport(); } void initializeConsumerControl() { diff --git a/src/key_events.cpp b/src/key_events.cpp index 2d070777..c89cae71 100644 --- a/src/key_events.cpp +++ b/src/key_events.cpp @@ -9,11 +9,8 @@ static bool handleSyntheticKeyswitchEvent(Key mappedKey, uint8_t keyState) { return false; if (mappedKey.flags & IS_CONSUMER) { - if (keyIsPressed(keyState)) { - } else if (keyWasPressed(keyState)) { + if (keyIsPressed(keyState)) kaleidoscope::hid::pressConsumerControl(mappedKey); - kaleidoscope::hid::releaseConsumerControl(mappedKey); - } } else if (mappedKey.flags & IS_SYSCTL) { if (keyIsPressed(keyState)) { } else if (keyWasPressed(keyState)) {