ref: simplify confirm held for caps logic

This commit is contained in:
Justin Luque 2026-01-19 12:38:22 -05:00
parent 1a34af2c87
commit 4462bfd5ef
No known key found for this signature in database
GPG Key ID: 5D19058FC4BE922F
2 changed files with 6 additions and 20 deletions

View File

@ -226,13 +226,12 @@ void KeyboardEntryActivity::loop() {
} }
// Selection // Selection
if (mappedInput.isPressed(MappedInputManager::Button::Confirm) && mappedInput.getHeldTime() >= capsMs) { if (mappedInput.wasPressed(MappedInputManager::Button::Confirm)) {
onCapsHeld(); if (mappedInput.getHeldTime() >= capsMs) {
return; shiftActive = !shiftActive;
} } else {
if (mappedInput.wasPressed(MappedInputManager::Button::Confirm) && mappedInput.getHeldTime() < capsMs) {
handleKeyPress(); handleKeyPress();
}
updateRequired = true; updateRequired = true;
} }
@ -358,13 +357,3 @@ void KeyboardEntryActivity::renderItemWithSelector(const int x, const int y, con
} }
renderer.drawText(UI_10_FONT_ID, x, y, item); renderer.drawText(UI_10_FONT_ID, x, y, item);
} }
void KeyboardEntryActivity::onCapsHeld() {
waitForCapsRelease();
shiftActive = !shiftActive;
updateRequired = true;
}
void KeyboardEntryActivity::waitForCapsRelease() {
while (mappedInput.isPressed(MappedInputManager::Button::Confirm)) delay(50);
}

View File

@ -96,7 +96,4 @@ class KeyboardEntryActivity : public Activity {
int getRowLength(int row) const; int getRowLength(int row) const;
void render() const; void render() const;
void renderItemWithSelector(int x, int y, const char* item, bool isSelected) const; void renderItemWithSelector(int x, int y, const char* item, bool isSelected) const;
void onCapsHeld();
void waitForCapsRelease();
}; };