Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ Krux now displays a warning instead of blocking QR-encoded passphrases that cont
Exported Uniform Resource (UR) QR codes, a widely adopted standard for exchanging PSBTs, now use uppercase data to reduce QR density, improving scan reliability without increasing the number of frames.

### Other Bug Fixes and Improvements
- Added backtick ` to keypad
- Settings: Reduced default _Buttons Debounce_ value (with an even lower default on _M5StickV_)
- Settings: Expanded value ranges for _Touch Threshold_ and _Buttons Debounce_
- Swipe handling: Detection threshold has been slightly reduced
- Keypad: Added backtick **`**
- Bugfix: Screensaver not activating in menu pages without statusbar
- Embit: Improved BIP39 mnemonic validation
- Bug Fix: Corrected handling of certain binary-encoded QR codes
Expand Down
5 changes: 3 additions & 2 deletions src/krux/krux_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ class ButtonsSettings(SettingsNamespace):
"""Buttons debounce settings"""

namespace = "settings.buttons"
debounce = NumberSetting(int, "debounce", 100, [100, 500])
default_deb = 50 if kboard.is_m5stickv else 80
debounce = NumberSetting(int, "debounce", default_deb, [20, 500])

def label(self, attr):
"""Returns a label for UI when given a setting name or namespace"""
Expand All @@ -314,7 +315,7 @@ class TouchSettings(SettingsNamespace):

namespace = "settings.touchscreen"
default_th = 40 if kboard.is_wonder_k else 22
threshold = NumberSetting(int, "threshold", default_th, [10, 200])
threshold = NumberSetting(int, "threshold", default_th, [2, 200])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any real situation where sensitivity had to be set so aggressively (value=2) ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't test against all possible device lots, so I'd rather leave this flexible. In some cases, like when the user is wearing gloves, higher sensitivity can be helpful

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it didn't brick any device (like being always pressed), it's fine.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user changes this value, the device immediately applies it before exiting the settings menu, so they will notice right away and can simply reset the device to revert to the previous value. I tested with a setting of 2 and didn't manage to brick any of my touch devices (couldn't test on the Amigo due to its existing touch issues): TZT, Yahboom, WonderMV, Embed Fire, WonderK Pro.

On the WonderK Pro, a little below 10 already feels good, and the Embed Fire was performing so well that it was already set to 2. Other devices had poorer results, but that's exactly why the setting exists: anyone can adjust it according to the behavior of their specific device, rather than us enforcing or constraining the value.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you for testing.


def label(self, attr):
"""Returns a label for UI when given a setting name or namespace"""
Expand Down
2 changes: 1 addition & 1 deletion src/krux/touch.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
PRESSED = 1
RELEASED = 2

SWIPE_THRESHOLD = 50
SWIPE_THRESHOLD = 35
SWIPE_RIGHT = 1
SWIPE_LEFT = 2
SWIPE_UP = 3
Expand Down
7 changes: 5 additions & 2 deletions tests/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ def test_debounce_presses_with_greater_interval(mocker, m5stickv):

def test_debounce_presses_with_smaller_interval(mocker, m5stickv):
from krux.input import Input, RELEASED, PRESSED
from krux.krux_settings import Settings

input = Input()
interval = 10 # ms
Expand All @@ -473,9 +474,11 @@ def test_debounce_presses_with_smaller_interval(mocker, m5stickv):
btn = input.wait_for_button()
assert btn == 0
assert input.entropy > 0
# Assert that the flush_events was called 10 times
# Assert that the flush_events was called debounce / interval times
# meaning that the debounce time was respected
assert input.flush_events.call_count == 10
assert (
input.flush_events.call_count == Settings().hardware.buttons.debounce / interval
)


def test_wait_for_button_blocks_until_enter_released(mocker, m5stickv):
Expand Down