fix(gui): stop discarding presses made during a screen transition - #292
Conversation
Press a direction right after switching screens and nothing happens. Found while investigating #271; verified in code, and separate from that report. guiMainLoop() polls the pads EVERY frame (gui.c) but only runs screenHandler->handleInput() when no transition is in flight. A fade is 26 frames -- about 430 ms at 60 Hz -- and every poll during it still advanced the key-on baseline, so the edge was consumed by a poll with nothing listening behind it. The press is simply gone. FIX. padFreezeEdgeBaseline() holds the edge baseline while a transition is running, so a key-on raised during the fade is still pending when the new screen takes over. Freezing the BASELINE rather than skipping the poll is deliberate: readPads() also expires rumble taps, drives the pad state machine and detects (dis)connects, so not calling it during a transition would leave a motor spinning and a replug unnoticed. Scope: armed ONLY while screenHandlerTarget is set. Ordinary same-screen navigation is untouched, deliberately -- the #271/#272 read-miss work is on hardware test right now and this must not perturb what is being measured. Residual: a press that is also RELEASED inside the fade is still lost, since the edge view reflects the current sample by then. Fixing that needs a sticky pending-press latch, which is the correct long-term design for this input layer but changes edge consumption everywhere and should not land mid-test. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📜 Recent review details⏰ Context from checks skipped due to timeout. (11)
🧰 Additional context used🪛 Cppcheck (2.21.0)src/pad.c[style] 209-209: The function 'padFreezeEdgeBaseline' is never used. (unusedFunction) 🔇 Additional comments (3)
📝 WalkthroughWalkthroughAdds a pad edge-baseline freeze API, applies it during GUI screen transitions, and prevents ChangesPad edge transition handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Press a direction right after switching screens and nothing happens.
Found while investigating #271, verified in code, and separate from that report — it can only fire during a screen fade, which continuous same-screen scrolling never hits.
The bug
guiMainLoop()polls the pads every frame (gui.c:2448) but only runsscreenHandler->handleInput()when no transition is in flight (gui.c:2468). A fade is 26 frames — ~430 ms at 60 Hz — and every poll during it still advanced the key-on baseline. The edge gets consumed by a poll with nothing listening behind it, and the press is simply gone.Fix
padFreezeEdgeBaseline()holds the edge baseline while a transition runs, so a key-on raised during the fade is still pending when the new screen takes over.Freezing the baseline rather than skipping the poll is deliberate.
readPads()also expires rumble taps, drives the pad state machine and detects (dis)connects — not calling it during a transition would leave a motor spinning and a replug unnoticed.Scope
Armed only while
screenHandlerTargetis set. Ordinary same-screen navigation is untouched, deliberately: the #271/#272 read-miss work is on hardware test right now and this must not perturb what's being measured.Residual
A press that is also released inside the fade is still lost, because the edge view reflects the current sample by then. Fixing that needs a sticky pending-press latch — which is the correct long-term design for this input layer, and would also fix the "tap falls entirely between two polls" half of zackcage6's hang — but it changes edge consumption everywhere and should not land mid-test.
Verification
make clean && make opl.elfgreen onps2dev:latest;clang-formatcleanpadFreezeEdgeBaselineconfirmed linked intoopl.elfvianm🤖 Generated with Claude Code
Summary by CodeRabbit