1
0
forked from me/IronOS

Fixup settings acceleration

This commit is contained in:
Ben V. Brown
2023-07-22 17:25:27 +10:00
parent 86fed6bfbe
commit 627d8f8be1
2 changed files with 11 additions and 2 deletions

View File

@@ -24,7 +24,13 @@ The use of these gives a notion of "direction" when navigating the menu.
│Soldering Mode│ │ │ │ │ │ │ │Soldering Mode│ │ │ │ │ │ │
│ OR ├───────────┤Home Menu ├───────────┤Settings Main Menu├───────────┤Settings sub menu│ │ OR ├───────────┤Home Menu ├───────────┤Settings Main Menu├───────────┤Settings sub menu│
│Reflow Mode│ │ │ │ │ │ │ │Reflow Mode│ │ │ │ │ │ │
└──────────────┘ └──────────┘ └──────────────────┘ └────────────────┘ └──────────────┘ └──────────┘ └──────────────────┘ └────────────────┘
┌─────────┴───────┐
│ │
│Settings sub menu│
│ │
└─────────────────┘
``` ```
The downside of supporting transitions is that for these to work, the code should render the screen _first_ then return the new state. The downside of supporting transitions is that for these to work, the code should render the screen _first_ then return the new state.

View File

@@ -170,7 +170,7 @@ OperatingMode gui_SettingsMenu(const ButtonState buttons, guiContext *cxt) {
case BUTTON_F_LONG: case BUTTON_F_LONG:
if (xTaskGetTickCount() + (*autoRepeatAcceleration) > (*autoRepeatTimer) + PRESS_ACCEL_INTERVAL_MAX) { if (xTaskGetTickCount() + (*autoRepeatAcceleration) > (*autoRepeatTimer) + PRESS_ACCEL_INTERVAL_MAX) {
if (callIncrementHandler()) { if (callIncrementHandler()) {
(*autoRepeatTimer) = 1000; (*autoRepeatTimer) = TICKS_SECOND * 2;
} else { } else {
(*autoRepeatTimer) = 0; (*autoRepeatTimer) = 0;
} }
@@ -212,6 +212,9 @@ OperatingMode gui_SettingsMenu(const ButtonState buttons, guiContext *cxt) {
default: default:
break; break;
} }
if ((PRESS_ACCEL_INTERVAL_MAX - (*autoRepeatAcceleration)) < PRESS_ACCEL_INTERVAL_MIN) {
(*autoRepeatAcceleration) = PRESS_ACCEL_INTERVAL_MAX - PRESS_ACCEL_INTERVAL_MIN;
}
// Otherwise we stay put for next render iteration // Otherwise we stay put for next render iteration
return newMode; return newMode;