- don't swallow keystrokes

- switch back and forth between the 2 modes.
This commit is contained in:
Thomas Göttgens
2022-09-20 14:28:42 +02:00
parent ab342ce904
commit d0ad5dd4cf
2 changed files with 9 additions and 7 deletions

View File

@@ -15,14 +15,14 @@ int32_t KbI2cBase::runOnce()
// Input device is not detected.
return INT32_MAX;
}
InputEvent e;
e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
e.source = this->_originName;
Wire.requestFrom(CARDKB_ADDR, 1);
while (Wire.available()) {
char c = Wire.read();
InputEvent e;
e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
e.source = this->_originName;
switch (c) {
case 0x1b: // ESC
e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL;
@@ -56,10 +56,10 @@ int32_t KbI2cBase::runOnce()
e.kbchar = c;
break;
}
}
if (e.inputEvent != ModuleConfig_CannedMessageConfig_InputEventChar_NONE) {
this->notifyObservers(&e);
if (e.inputEvent != ModuleConfig_CannedMessageConfig_InputEventChar_NONE) {
this->notifyObservers(&e);
}
}
return 500;
}