From a69b95187be4afce4eefa8f7b08ceca7b88b7724 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 15 Jan 2025 15:37:35 +1100 Subject: Handle lock state in each input device, instead of in the lvgl driver --- src/tangara/input/input_touch_wheel.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (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 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& { -- cgit v1.2.3