Repository navigation
Use side buttons to confirm dice rolls - #1078
Open
AdamFerguson wants to merge 1 commit into
Open
AdamFerguson wants to merge 1 commit into
AdamFerguson wants to merge 1 commit into
Conversation
The dice-entry screen only accepted the joystick center press to lock in the highlighted die, so an accidental joystick click while navigating silently recorded an extra roll and corrupted the entropy sequence. KeyboardScreen now takes a `key_confirm_inputs` list that defines which hardware inputs lock in the highlighted key. The default is unchanged (joystick center press only), so every other keyboard screen behaves exactly as before. ToolsDiceEntropyEntryScreen opts in to `KEYS__ANYCLICK`, i.e. the joystick center press plus KEY1, KEY2 and KEY3, matching how the ButtonListScreens already accept any click to select an entry. No UI changes. Adds tests/test_keyboard_screen.py covering all four confirmation inputs, the unchanged default, top-nav back navigation, backspace, and the KEY3 save button.
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.
Description
Problem or Issue being addressed
The dice-entry screen used the joystick for both navigation and confirmation: the joystick center press was the only way to lock in the highlighted die. During a long entry sequence an accidental center press while moving between dice is recorded immediately as an extra roll, and the resulting duplicate digit is easy to miss in the compact roll history. #988 hit this while entering a 99-roll sequence across multiple devices and had to restart.
Solution
KeyboardScreengains akey_confirm_inputsfield that defines which hardware inputs lock in the highlighted key. The default stays[KEY_PRESS], so every other keyboard screen (passphrase, seed words, BIP85 child index, custom derivation path, coin flip) behaves exactly as before.ToolsDiceEntropyEntryScreenopts in toHardwareButtonsConstants.KEYS__ANYCLICK— the joystick center press plusKEY1,KEY2andKEY3.This implements the approach kdmukai preferred in #988 (comment) — "Just enable
ANYCLICKhandling for this screen ... but make no UI changes" — rather than the green check button from #988, which reads as "I'm done" everywhere else in the keyboard UI (see #988 (comment)).KEYS__ANYCLICKis already howButtonListScreentreats any click as "select", so the dice screen now matches the rest of the UI.Additional Information
Tested hands-on on SeedSigner OS on a Pi Zero 1.3, using a
pi0image built from this branch: each side button records exactly one roll (middle button included), joystick navigation still moves the selection, and passphrase/seed-word entry still saves withKEY3.Tests:
pytest tests/test_keyboard_screen.py-> 9 passed. Covers all four confirmation inputs, the unchanged default for other keyboard screens, top-nav back navigation, backspace and theKEY3save button. The full flow suite was not run locally (nozbarshared library on the authoring machine).One deliberate difference from #988:
KEYS__ANYCLICKincludesKEY_PRESS, so an accidental joystick center press still records a die. schjonhaug argued for strict separation so the joystick press can never alter entropy (#988 (comment)). If you'd prefer that, it is a one-line change: setkey_confirm_inputsto[KEY1, KEY2, KEY3]on the dice screen.This pull request is categorized as a:
Checklist
I ran
pytestlocallyI included screenshots of any new or modified screens
No UI changes, so there is nothing new to screenshot.
I added or updated tests
Any new or altered functionality should be covered in a unit test. Any new or updated sequences require FlowTests.
I tested this PR hands-on on the following platform(s):
I have reviewed these notes:
Thank you! Please join our Devs' Telegram group to get more involved.