feat: Make page turn naturally follow orientation (#2023)

This commit is contained in:
Jackson
2026-05-19 23:13:27 +03:00
committed by GitHub
parent b69111bea5
commit beb7876ccf
27 changed files with 48 additions and 9 deletions
+10 -3
View File
@@ -68,6 +68,13 @@ unsigned long MappedInputManager::getHeldTime() const { return gpio.getHeldTime(
MappedInputManager::Labels MappedInputManager::mapLabels(const char* back, const char* confirm, const char* previous,
const char* next) const {
// Swap previous/next labels to match the page turn direction swap in INVERTED and LANDSCAPE_CCW.
const bool swapLabels =
SETTINGS.frontButtonFollowOrientation && (SETTINGS.orientation == CrossPointSettings::INVERTED ||
SETTINGS.orientation == CrossPointSettings::LANDSCAPE_CCW);
const char* leftLabel = swapLabels ? next : previous;
const char* rightLabel = swapLabels ? previous : next;
// Build the label order based on the configured hardware mapping.
auto labelForHardware = [&](uint8_t hw) -> const char* {
// Compare against configured logical roles and return the matching label.
@@ -78,10 +85,10 @@ MappedInputManager::Labels MappedInputManager::mapLabels(const char* back, const
return confirm;
}
if (hw == SETTINGS.frontButtonLeft) {
return previous;
return leftLabel;
}
if (hw == SETTINGS.frontButtonRight) {
return next;
return rightLabel;
}
return "";
};
@@ -106,4 +113,4 @@ int MappedInputManager::getPressedFrontButton() const {
return HalGPIO::BTN_RIGHT;
}
return -1;
}
}