From 6c323f0fd075beb406df04d444fc4029b733ceb4 Mon Sep 17 00:00:00 2001 From: Rockwell Schrock Date: Sat, 1 Feb 2025 00:16:04 -0500 Subject: Don't detect center button touch until 250ms after wheel touch --- src/tangara/input/input_touch_wheel.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/tangara/input/input_touch_wheel.cpp') diff --git a/src/tangara/input/input_touch_wheel.cpp b/src/tangara/input/input_touch_wheel.cpp index 19ac5211..6621a77e 100644 --- a/src/tangara/input/input_touch_wheel.cpp +++ b/src/tangara/input/input_touch_wheel.cpp @@ -21,6 +21,8 @@ #include "lua/property.hpp" #include "ui/ui_events.hpp" +#include "esp_timer.h" + namespace input { TouchWheel::TouchWheel(drivers::NvsStorage& nvs, drivers::TouchWheel& wheel) @@ -77,7 +79,16 @@ auto TouchWheel::read(lv_indev_data_t* data) -> void { data->enc_diff = 0; } - centre_.update(wheel_data.is_button_touched && !wheel_data.is_wheel_touched, + // Prevent accidental center button touches while scrolling + if (wheel_data.is_wheel_touched) { + last_wheel_touch_time_ = esp_timer_get_time(); + } + + bool wheel_touch_timed_out = + esp_timer_get_time() - last_wheel_touch_time_ > SCROLL_TIMEOUT_US; + + centre_.update(wheel_touch_timed_out && wheel_data.is_button_touched && + !wheel_data.is_wheel_touched, data); // If the user is touching the wheel but not scrolling, then they may be -- cgit v1.2.3 From e8eaf3df10a896cb28e91cfc416b19303926a00a Mon Sep 17 00:00:00 2001 From: Tess Eisenberger Date: Sat, 1 Feb 2025 15:59:08 -0800 Subject: Add a new setting for input controls when locked This is just the plumbing of the new setting. The input methods will come in subsequent patches. --- src/tangara/input/input_touch_wheel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tangara/input/input_touch_wheel.cpp') diff --git a/src/tangara/input/input_touch_wheel.cpp b/src/tangara/input/input_touch_wheel.cpp index 19ac5211..ea6d1b56 100644 --- a/src/tangara/input/input_touch_wheel.cpp +++ b/src/tangara/input/input_touch_wheel.cpp @@ -113,7 +113,7 @@ auto TouchWheel::triggers() return {centre_, up_, right_, down_, left_}; } -auto TouchWheel::onLock() -> void { +auto TouchWheel::onLock(drivers::NvsStorage::LockedInputModes mode) -> void { wheel_.LowPowerMode(true); locked_ = true; } -- cgit v1.2.3