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/relative_wheel.cpp | |
| 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/relative_wheel.cpp')
| -rw-r--r-- | src/drivers/relative_wheel.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
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; } |
