| 87 | unsigned long MappedInputManager::getHeldTime() const { return gpio.getHeldTime(); } |
| 88 | |
| 89 | MappedInputManager::Labels MappedInputManager::mapLabels(const char* back, const char* confirm, const char* previous, |
| 90 | const char* next) const { |
| 91 | // Swap previous/next labels to match the page turn direction swap in INVERTED and LANDSCAPE_CCW. |
| 92 | const bool swapLabels = isNavDirectionSwapped(); |
| 93 | const char* leftLabel = swapLabels ? next : previous; |
| 94 | const char* rightLabel = swapLabels ? previous : next; |
| 95 | |
| 96 | // Build the label order based on the configured hardware mapping. |
| 97 | auto labelForHardware = [&](uint8_t hw) -> const char* { |
| 98 | // Compare against configured logical roles and return the matching label. |
| 99 | if (hw == SETTINGS.frontButtonBack) { |
| 100 | return back; |
| 101 | } |
| 102 | if (hw == SETTINGS.frontButtonConfirm) { |
| 103 | return confirm; |
| 104 | } |
| 105 | if (hw == SETTINGS.frontButtonLeft) { |
| 106 | return leftLabel; |
| 107 | } |
| 108 | if (hw == SETTINGS.frontButtonRight) { |
| 109 | return rightLabel; |
| 110 | } |
| 111 | return ""; |
| 112 | }; |
| 113 | |
| 114 | return {labelForHardware(HalGPIO::BTN_BACK), labelForHardware(HalGPIO::BTN_CONFIRM), |
| 115 | labelForHardware(HalGPIO::BTN_LEFT), labelForHardware(HalGPIO::BTN_RIGHT)}; |
| 116 | } |
| 117 | |
| 118 | int MappedInputManager::getPressedFrontButton() const { |
| 119 | // Scan the raw front buttons in hardware order. |
no outgoing calls
no test coverage detected