diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-10-18 14:35:28 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-10-18 14:35:28 +1100 |
| commit | 782e8dc8c25402171fc4724075b998eae4fa2c76 (patch) | |
| tree | f710f8fe8e84f5a201410520f3f88364a19f76d8 /src/ui/encoder_input.cpp | |
| parent | 2eb7eaa2a6a5d9ccfe7a0535858778dfb85997cb (diff) | |
| download | tangara-fw-782e8dc8c25402171fc4724075b998eae4fa2c76.tar.gz | |
Add better controls for queue manipulation
Diffstat (limited to 'src/ui/encoder_input.cpp')
| -rw-r--r-- | src/ui/encoder_input.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ui/encoder_input.cpp b/src/ui/encoder_input.cpp index 0345665b..f6a981a7 100644 --- a/src/ui/encoder_input.cpp +++ b/src/ui/encoder_input.cpp @@ -9,7 +9,10 @@ #include <sys/_stdint.h> #include <memory> +#include "lvgl.h" + #include "audio_events.hpp" +#include "core/lv_event.h" #include "core/lv_group.h" #include "esp_timer.h" #include "event_queue.hpp" @@ -20,6 +23,8 @@ #include "touchwheel.hpp" #include "ui_events.hpp" +static constexpr char kTag[] = "input"; + constexpr int kDPadAngleThreshold = 20; constexpr int kLongPressDelayMs = 500; constexpr int kRepeatDelayMs = 250; @@ -58,6 +63,11 @@ auto EncoderInput::Read(lv_indev_data_t* data) -> void { return; } + lv_obj_t* active_object = nullptr; + if (registration_ && registration_->group) { + active_object = lv_group_get_focused(registration_->group); + } + raw_wheel_.Update(); relative_wheel_->Update(); // GPIOs updating is handled by system_fsm. @@ -226,8 +236,9 @@ auto EncoderInput::Read(lv_indev_data_t* data) -> void { data->state = LV_INDEV_STATE_PRESSED; break; case Trigger::kLongPress: - // TODO: ??? - data->state = LV_INDEV_STATE_PRESSED; + if (active_object) { + lv_event_send(active_object, LV_EVENT_LONG_PRESSED, NULL); + } break; } |
