Support swapping the functionality of the front buttons (#133)
## Summary **What is the goal of this PR?** Adds a setting to swap the front buttons. The default functionality are: Back/Confirm/Left/Right. When this setting is enabled they become: Left/Right/Back/Confirm. This makes it more comfortable to use when holding in your right hand since your thumb can more easily rest on the next button. The original firmware has a similar setting. **What changes are included?** - Add the new setting. - Create a mapper to dynamically switch the buttons based on the setting. - Use mapper on the various activity screens. - Update the button hints to reflect the swapped buttons. ## Additional Context Full disclosure: I used Codex CLI to put this PR together, but did review it to make sure it makes sense. Also tested on my device: https://share.cleanshot.com/k76891NY
This commit is contained in:
@@ -138,7 +138,7 @@ void KeyboardEntryActivity::handleKeyPress() {
|
||||
|
||||
void KeyboardEntryActivity::loop() {
|
||||
// Navigation
|
||||
if (inputManager.wasPressed(InputManager::BTN_UP)) {
|
||||
if (mappedInput.wasPressed(MappedInputManager::Button::Up)) {
|
||||
if (selectedRow > 0) {
|
||||
selectedRow--;
|
||||
// Clamp column to valid range for new row
|
||||
@@ -148,7 +148,7 @@ void KeyboardEntryActivity::loop() {
|
||||
updateRequired = true;
|
||||
}
|
||||
|
||||
if (inputManager.wasPressed(InputManager::BTN_DOWN)) {
|
||||
if (mappedInput.wasPressed(MappedInputManager::Button::Down)) {
|
||||
if (selectedRow < NUM_ROWS - 1) {
|
||||
selectedRow++;
|
||||
const int maxCol = getRowLength(selectedRow) - 1;
|
||||
@@ -157,7 +157,7 @@ void KeyboardEntryActivity::loop() {
|
||||
updateRequired = true;
|
||||
}
|
||||
|
||||
if (inputManager.wasPressed(InputManager::BTN_LEFT)) {
|
||||
if (mappedInput.wasPressed(MappedInputManager::Button::Left)) {
|
||||
// Special bottom row case
|
||||
if (selectedRow == SPECIAL_ROW) {
|
||||
// Bottom row has special key widths
|
||||
@@ -187,7 +187,7 @@ void KeyboardEntryActivity::loop() {
|
||||
updateRequired = true;
|
||||
}
|
||||
|
||||
if (inputManager.wasPressed(InputManager::BTN_RIGHT)) {
|
||||
if (mappedInput.wasPressed(MappedInputManager::Button::Right)) {
|
||||
const int maxCol = getRowLength(selectedRow) - 1;
|
||||
|
||||
// Special bottom row case
|
||||
@@ -220,13 +220,13 @@ void KeyboardEntryActivity::loop() {
|
||||
}
|
||||
|
||||
// Selection
|
||||
if (inputManager.wasPressed(InputManager::BTN_CONFIRM)) {
|
||||
if (mappedInput.wasPressed(MappedInputManager::Button::Confirm)) {
|
||||
handleKeyPress();
|
||||
updateRequired = true;
|
||||
}
|
||||
|
||||
// Cancel
|
||||
if (inputManager.wasPressed(InputManager::BTN_BACK)) {
|
||||
if (mappedInput.wasPressed(MappedInputManager::Button::Back)) {
|
||||
if (onCancel) {
|
||||
onCancel();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user