keymon: Refresh system state before acting on SELECT - #1936
Open
robcodedev wants to merge 1 commit into
Open
Conversation
system_state is only re-read when /tmp/state_changed exists, on a MENU press, or from deepsleep(). That leaves it MODE_UNKNOWN after a fresh boot, and stale after returning from a game, where keymon consumes and removes the file before MainUI is back up. Either way the SELECT -> MENU shortcut reads the wrong value and silently does nothing until something else forces an update, which is what made it look intermittent. Re-read the state here before branching on it. This runs once per SELECT tap, not on repeat, so the process scan it costs isn't on any hot path.
Copilot AI
added a commit
to Amiga500/Onion
that referenced
this pull request
Sep 9, 2026
…1943 OnionUI#1944 OnionUI#1945 OnionUI#1946 (runtime.sh, keymon, lt.lang) Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Amiga500
added a commit
to Amiga500/Onion
that referenced
this pull request
Sep 9, 2026
Port OnionUI PRs OnionUI#1936–OnionUI#1946 (launch prep, fb transitions, GameSwitcher favorites/crash fixes, theme previews) — thanks @robcodedev
Amiga500
added a commit
to Amiga500/Onion
that referenced
this pull request
Sep 10, 2026
…view Refresh README and companion reports for onionplus-compact: ports of OnionUI PRs OnionUI#1936-1946 plus list-cache, installer Flip, boot FB, and AXP percBat fixes. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix intermittent SELECT -> MENU shortcut on Miyoo Mini v4 and Miyoo Flip.
system_stateis a cached value, only re-read when/tmp/state_changedexists, on a MENU press, or from
deepsleep(). Two situations can leave itwrong:
MODE_UNKNOWN/tmp/state_changedbefore MainUI is back upIn both cases the SELECT -> MENU shortcut compares against the wrong value and
does nothing. It starts working once a state transition or MENU press forces an
update, which made it look intermittent rather than broken.
This re-reads the state in the handler before branching on it. The call sits
behind
!comboKey_select && val == RELEASED, so it runs once per SELECT tap.Scope
Deliberately limited to SELECT. Five other handlers read the same cached value
and might have the same problem, but I couldn't reproduce any issues with
other key presses.
Open question
Reported on v4 and Flip but not on Plus. I couldn't find a device-dependent
path in the state logic to explain that, so if anyone knows where the boot
ordering differs I'd like to hear it. The fix isn't device-specific either way.
Testing