mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-01 23:08:19 +00:00
UIScreen gains onDisplayOff()/onDisplayOn() hooks. JoystickUITask tracks display state and dispatches them on transition — at top of loop() (catches display.c's auto-off, which fires behind our back) and right after _display.turnOn() in the wake path (immediate resume). Override in SnakeScreen and GPSSettingsScreen: stop their periodic k_timers while the screen is off, restart on wake. Game state and GPS-fix state are preserved across sleep. Snake doesn't crash into a wall five seconds after the screen sleeps anymore. Other screen timers (Countdown alarm, Contacts/Admin response timeout, the global lock timer) intentionally keep running — their job is to fire while the user is idle. Also: wake-from-off now reschedules the lock timer if not already locked, so a keypress near the end of the lock window gives you a fresh LOCK_AFTER_MS instead of being immediately re-locked.