|
|
@ -21,6 +21,8 @@ |
|
|
|
#include "lua/property.hpp" |
|
|
|
#include "lua/property.hpp" |
|
|
|
#include "ui/ui_events.hpp" |
|
|
|
#include "ui/ui_events.hpp" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "esp_timer.h" |
|
|
|
|
|
|
|
|
|
|
|
namespace input { |
|
|
|
namespace input { |
|
|
|
|
|
|
|
|
|
|
|
TouchWheel::TouchWheel(drivers::NvsStorage& nvs, drivers::TouchWheel& wheel) |
|
|
|
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; |
|
|
|
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); |
|
|
|
data); |
|
|
|
|
|
|
|
|
|
|
|
// If the user is touching the wheel but not scrolling, then they may be
|
|
|
|
// If the user is touching the wheel but not scrolling, then they may be
|
|
|
|