summaryrefslogtreecommitdiff
path: root/src/tangara/input/input_touch_wheel.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2025-01-15 15:37:35 +1100
committerjacqueline <me@jacqueline.id.au>2025-01-15 15:37:35 +1100
commita69b95187be4afce4eefa8f7b08ceca7b88b7724 (patch)
tree42b39630c4fac348c87b2e2d4db3cb115f1d83cd /src/tangara/input/input_touch_wheel.cpp
parentdfb4ea54581de68a042746e9f7291ac2f833d47d (diff)
downloadtangara-fw-a69b95187be4afce4eefa8f7b08ceca7b88b7724.tar.gz
Handle lock state in each input device, instead of in the lvgl driver
Diffstat (limited to 'src/tangara/input/input_touch_wheel.cpp')
-rw-r--r--src/tangara/input/input_touch_wheel.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tangara/input/input_touch_wheel.cpp b/src/tangara/input/input_touch_wheel.cpp
index a5069ae4..19ac5211 100644
--- a/src/tangara/input/input_touch_wheel.cpp
+++ b/src/tangara/input/input_touch_wheel.cpp
@@ -48,12 +48,17 @@ TouchWheel::TouchWheel(drivers::NvsStorage& nvs, drivers::TouchWheel& wheel)
actions::scrollToBottom(),
actions::scrollToBottom()),
left_("left", {}, {}, actions::goBack(), {}),
+ locked_(false),
is_scrolling_(false),
threshold_(calculateThreshold(nvs.ScrollSensitivity())),
is_first_read_(true),
last_angle_(0) {}
auto TouchWheel::read(lv_indev_data_t* data) -> void {
+ if (locked_) {
+ return;
+ }
+
wheel_.Update();
auto wheel_data = wheel_.GetTouchWheelData();
int8_t ticks = calculateTicks(wheel_data);
@@ -110,11 +115,13 @@ auto TouchWheel::triggers()
auto TouchWheel::onLock() -> void {
wheel_.LowPowerMode(true);
+ locked_ = true;
}
auto TouchWheel::onUnlock() -> void {
wheel_.LowPowerMode(false);
wheel_.Recalibrate();
+ locked_ = false;
}
auto TouchWheel::sensitivity() -> lua::Property& {