From 3202bc417e403e90b58aeeb42d2ba73f6552c5fc Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 21 Nov 2018 07:11:05 +0100 Subject: [PATCH] hardware/ErgoDox: Reset our latest state when updating Kaleidoscope Set the previous key state when reporting the state to Kaleidoscope, instead of on every read. This eliminates a possible chatter bug. Idea taken from a similar change made to `ATMegaKeyboard`. Signed-off-by: Gergely Nagy --- src/kaleidoscope/hardware/ez/ErgoDox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kaleidoscope/hardware/ez/ErgoDox.cpp b/src/kaleidoscope/hardware/ez/ErgoDox.cpp index ce12d28e..92ee98b9 100644 --- a/src/kaleidoscope/hardware/ez/ErgoDox.cpp +++ b/src/kaleidoscope/hardware/ez/ErgoDox.cpp @@ -85,7 +85,6 @@ ISR(TIMER1_OVF_vect) { void ErgoDox::readMatrixRow(uint8_t row) { uint8_t mask, cols; - previousKeyState_[row] = keyState_[row]; mask = debounceMaskForRow(row); cols = (scanner_.readCols(row) & mask) | (keyState_[row] & ~mask); debounceRow(cols ^ keyState_[row], row); @@ -116,6 +115,7 @@ void ErgoDox::actOnMatrixScan() { if (keyState) handleKeyswitchEvent(Key_NoKey, row, col, keyState); } + previousKeyState_[row] = keyState_[row]; } }