diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-08-25 16:59:39 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-08-25 16:59:39 +1000 |
| commit | 0f5cf25e73fb2e789b472317966ff80323dddd75 (patch) | |
| tree | 714bce08328a8cc86e1cb97a1c60fb0a267ff49d /src/drivers | |
| parent | 485e9adfce01b9b4e21dae927fb3b7ed3d5fc83d (diff) | |
| download | tangara-fw-0f5cf25e73fb2e789b472317966ff80323dddd75.tar.gz | |
More performance and usability tweaks
- pin ui and decoder to opposite cores
- disable touch wheel when controls are locked
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/include/relative_wheel.hpp | 12 | ||||
| -rw-r--r-- | src/drivers/relative_wheel.cpp | 14 |
2 files changed, 19 insertions, 7 deletions
diff --git a/src/drivers/include/relative_wheel.hpp b/src/drivers/include/relative_wheel.hpp index 6edc006a..5e801aba 100644 --- a/src/drivers/include/relative_wheel.hpp +++ b/src/drivers/include/relative_wheel.hpp @@ -26,17 +26,21 @@ class RelativeWheel { explicit RelativeWheel(TouchWheel* touch); - // Not copyable or movable. - RelativeWheel(const RelativeWheel&) = delete; - RelativeWheel& operator=(const RelativeWheel&) = delete; - auto Update() -> void; + auto SetEnabled(bool) -> void; auto is_clicking() -> bool; auto ticks() -> std::int_fast16_t; + // Not copyable or movable. + RelativeWheel(const RelativeWheel&) = delete; + RelativeWheel& operator=(const RelativeWheel&) = delete; + private: TouchWheel* touch_; + + bool is_enabled_; + bool is_clicking_; bool was_clicking_; bool is_first_read_; diff --git a/src/drivers/relative_wheel.cpp b/src/drivers/relative_wheel.cpp index 846d0e7b..75b62ae7 100644 --- a/src/drivers/relative_wheel.cpp +++ b/src/drivers/relative_wheel.cpp @@ -15,6 +15,7 @@ namespace drivers { RelativeWheel::RelativeWheel(TouchWheel* touch) : touch_(touch), + is_enabled_(true), is_clicking_(false), was_clicking_(false), is_first_read_(true), @@ -60,17 +61,24 @@ auto RelativeWheel::Update() -> void { } } +auto RelativeWheel::SetEnabled(bool en) -> void { + is_enabled_ = en; +} + auto RelativeWheel::is_clicking() -> bool { + if (!is_enabled_) { + return false; + } bool ret = is_clicking_; is_clicking_ = 0; return ret; } auto RelativeWheel::ticks() -> std::int_fast16_t { - int_fast16_t t = ticks_; - if (t != 0) { - ESP_LOGI("teeks", "ticks %d", t); + if (!is_enabled_) { + return 0; } + int_fast16_t t = ticks_; ticks_ = 0; return t; } |
