Small change on Touch Threshold, Buttons Debounce and Swipe Threshold constant (#793)
What changed, and why it matters
This commit adjusts user-interface timing and sensitivity constants for the Krux hardware wallet: button debounce times are lowered, the allowed range for touch sensitivity is widened, and the swipe gesture threshold is reduced. These are usability/tuning changes, not security fixes. There is no indication in the commit or changelog that any vulnerability is being addressed.
No security action required; treat as routine UX/hardware tuning.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch changes default and range values in krux_settings.py for ButtonsSettings.debounce (default 50 ms on M5StickV, 80 ms otherwise; range [20, 500]) and TouchSettings.threshold (range [2, 200]), and lowers SWIPE_THRESHOLD from 50 to 35 in touch.py. A unit test is updated to derive expected flush count from the configured debounce value rather than a hard-coded 10. The changelog frames these as bug fixes and improvements, not security issues.
Changed components
src/krux/krux_settings.pysrc/krux/touch.pytests/test_input.pyInspect captured patch +13 / −6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f7408f5..e9295d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/src/krux/krux_settings.py b/src/krux/krux_settings.py
index b10719f..c781505 100644
--- a/src/krux/krux_settings.py
+++ b/src/krux/krux_settings.py
@@ -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"""
@@ -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])
def label(self, attr):
"""Returns a label for UI when given a setting name or namespace"""
diff --git a/src/krux/touch.py b/src/krux/touch.py
index c7d5dc0..3bdece8 100644
--- a/src/krux/touch.py
+++ b/src/krux/touch.py
@@ -30,7 +30,7 @@ IDLE = 0
PRESSED = 1
RELEASED = 2
-SWIPE_THRESHOLD = 50
+SWIPE_THRESHOLD = 35
SWIPE_RIGHT = 1
SWIPE_LEFT = 2
SWIPE_UP = 3
diff --git a/tests/test_input.py b/tests/test_input.py
index 38e67cb..bd64a33 100644
--- a/tests/test_input.py
+++ b/tests/test_input.py
@@ -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
@@ -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):
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.