Merge pull request #23 from keyboardio/f/actOnHalfRow/no-handler-calls-in-the-idle-case

actOnHalfRow: Do not handle events on fully idle positions
pull/365/head
Gergely Nagy 7 years ago committed by GitHub
commit 1c9a786597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -158,15 +158,12 @@ void Model01::readMatrix() {
} }
void Model01::actOnHalfRow(byte row, byte colState, byte colPrevState, byte startPos) { void Model01::actOnHalfRow(byte row, byte colState, byte colPrevState, byte startPos) {
if ((colState == colPrevState) && (colState == 0)) { if ((colState != colPrevState) || (colState != 0)) {
for (byte col = 0; col < 8; col++) {
handleKeyswitchEvent(Key_NoKey, row, startPos - col, 0);
}
} else {
for (byte col = 0; col < 8; col++) { for (byte col = 0; col < 8; col++) {
// Build up the key state for row, col // Build up the key state for row, col
uint8_t keyState = ((bitRead(colPrevState, 0) << 0) | uint8_t keyState = ((bitRead(colPrevState, 0) << 0) |
(bitRead(colState, 0) << 1)); (bitRead(colState, 0) << 1));
if (keyState)
handleKeyswitchEvent(Key_NoKey, row, startPos - col, keyState); handleKeyswitchEvent(Key_NoKey, row, startPos - col, keyState);
// Throw away the data we've just used, so we can read the next column // Throw away the data we've just used, so we can read the next column

Loading…
Cancel
Save