1
0
forked from me/IronOS

Rework button handling

This commit is contained in:
Ben V. Brown
2023-07-21 19:19:22 +10:00
parent 1a936b84f2
commit 2d8378c39d

View File

@@ -79,6 +79,11 @@ OperatingMode moveToNextEntry(guiContext *cxt) {
cxt->transitionMode = TransitionAnimation::Left; cxt->transitionMode = TransitionAnimation::Left;
return OperatingMode::HomeScreen; return OperatingMode::HomeScreen;
} }
// Check if visible
if (rootSettingsMenu[*mainEntry].isVisible != nullptr && !rootSettingsMenu[*mainEntry].isVisible()) {
// We need to move on as this one isn't visible
return moveToNextEntry(cxt);
}
} else { } else {
(*subEntry) += 1; (*subEntry) += 1;
// If the new entry is null, we need to exit // If the new entry is null, we need to exit
@@ -88,7 +93,7 @@ OperatingMode moveToNextEntry(guiContext *cxt) {
} }
// Check if visible // Check if visible
if (subSettingsMenus[*mainEntry][*subEntry].isVisible != nullptr && !subSettingsMenus[*mainEntry][*subEntry].isVisible()) { if (subSettingsMenus[*mainEntry][*subEntry].isVisible != nullptr && !subSettingsMenus[*mainEntry][*subEntry].isVisible()) {
// We need to move on as this one isnt visible // We need to move on as this one isn't visible
return moveToNextEntry(cxt); return moveToNextEntry(cxt);
} }
} }
@@ -188,7 +193,7 @@ OperatingMode gui_SettingsMenu(const ButtonState buttons, guiContext *cxt) {
} }
break; break;
case BUTTON_B_LONG: case BUTTON_B_LONG:
if (xTaskGetTickCount() - (*autoRepeatTimer) + (*autoRepeatAcceleration) > PRESS_ACCEL_INTERVAL_MAX) { if (xTaskGetTickCount() + (*autoRepeatAcceleration) > (*autoRepeatTimer) + PRESS_ACCEL_INTERVAL_MAX) {
(*autoRepeatTimer) = xTaskGetTickCount(); (*autoRepeatTimer) = xTaskGetTickCount();
(*autoRepeatAcceleration) += PRESS_ACCEL_STEP; (*autoRepeatAcceleration) += PRESS_ACCEL_STEP;
} else { } else {