feat: front button remapper (#664)

## Summary

* Custom remapper to create any variant of front button layout.

## Additional Context

* Included migration from previous frontlayout setting
* This will solve:
    *  https://github.com/crosspoint-reader/crosspoint-reader/issues/654
    * https://github.com/crosspoint-reader/crosspoint-reader/issues/652
    * https://github.com/crosspoint-reader/crosspoint-reader/issues/620
    * https://github.com/crosspoint-reader/crosspoint-reader/issues/468

<img width="860" height="1147" alt="image"
src="https://github.com/user-attachments/assets/457356ed-7a7d-4e1c-8683-e187a1df47c0"
/>



---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**< PARTIALLY >**_
This commit is contained in:
Arthur Tazhitdinov
2026-02-05 14:37:17 +03:00
committed by GitHub
parent bf87a7dc60
commit c49a819939
7 changed files with 432 additions and 43 deletions

View File

@@ -42,7 +42,7 @@ class CrossPointSettings {
ORIENTATION_COUNT
};
// Front button layout options
// Front button layout options (legacy)
// Default: Back, Confirm, Left, Right
// Swapped: Left, Right, Back, Confirm
enum FRONT_BUTTON_LAYOUT {
@@ -53,6 +53,15 @@ class CrossPointSettings {
FRONT_BUTTON_LAYOUT_COUNT
};
// Front button hardware identifiers (for remapping)
enum FRONT_BUTTON_HARDWARE {
FRONT_HW_BACK = 0,
FRONT_HW_CONFIRM = 1,
FRONT_HW_LEFT = 2,
FRONT_HW_RIGHT = 3,
FRONT_BUTTON_HARDWARE_COUNT
};
// Side button layout options
// Default: Previous, Next
// Swapped: Next, Previous
@@ -116,9 +125,15 @@ class CrossPointSettings {
// EPUB reading orientation settings
// 0 = portrait (default), 1 = landscape clockwise, 2 = inverted, 3 = landscape counter-clockwise
uint8_t orientation = PORTRAIT;
// Button layouts
// Button layouts (front layout retained for migration only)
uint8_t frontButtonLayout = BACK_CONFIRM_LEFT_RIGHT;
uint8_t sideButtonLayout = PREV_NEXT;
// Front button remap (logical -> hardware)
// Used by MappedInputManager to translate logical buttons into physical front buttons.
uint8_t frontButtonBack = FRONT_HW_BACK;
uint8_t frontButtonConfirm = FRONT_HW_CONFIRM;
uint8_t frontButtonLeft = FRONT_HW_LEFT;
uint8_t frontButtonRight = FRONT_HW_RIGHT;
// Reader font settings
uint8_t fontFamily = BOOKERLY;
uint8_t fontSize = MEDIUM;