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; } diff --git a/src/ui/lvgl_task.cpp b/src/ui/lvgl_task.cpp index d13ef5aa..a9af0900 100644 --- a/src/ui/lvgl_task.cpp +++ b/src/ui/lvgl_task.cpp @@ -109,7 +109,7 @@ void LvglMain(std::weak_ptr weak_touch_wheel, auto StartLvgl(std::weak_ptr touch_wheel, std::weak_ptr display) -> void { tasks::StartPersistent( - [=]() { LvglMain(touch_wheel, display); }); + 0, [=]() { LvglMain(touch_wheel, display); }); } } // namespace ui diff --git a/src/ui/screen_track_browser.cpp b/src/ui/screen_track_browser.cpp index c534b423..67c47628 100644 --- a/src/ui/screen_track_browser.cpp +++ b/src/ui/screen_track_browser.cpp @@ -177,6 +177,7 @@ auto TrackBrowser::AddResults( text = "[ no data ]"; } lv_obj_t* item = lv_list_add_btn(list_, NULL, text->c_str()); + lv_label_set_long_mode(lv_obj_get_child(item, -1), LV_LABEL_LONG_DOT); lv_obj_add_event_cb(item, item_click_cb, LV_EVENT_CLICKED, this); lv_obj_add_event_cb(item, item_select_cb, LV_EVENT_FOCUSED, this); diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp index e8660207..508fb740 100644 --- a/src/ui/ui_fsm.cpp +++ b/src/ui/ui_fsm.cpp @@ -97,6 +97,7 @@ void UiState::PopScreen() { void UiState::react(const system_fsm::KeyLockChanged& ev) { sDisplay->SetDisplayOn(ev.falling); + sRelativeWheel->SetEnabled(ev.falling); } void UiState::react(const system_fsm::BatteryPercentChanged&) { diff --git a/src/ui/widget_top_bar.cpp b/src/ui/widget_top_bar.cpp index 2d2e13dc..7d4ef98c 100644 --- a/src/ui/widget_top_bar.cpp +++ b/src/ui/widget_top_bar.cpp @@ -66,15 +66,15 @@ auto TopBar::Update(const State& state) -> void { } if (state.battery_percent >= 95) { - lv_label_set_text(battery_, LV_SYMBOL_BATTERY_FULL); + lv_label_set_text(battery_, "100"); } else if (state.battery_percent >= 70) { - lv_label_set_text(battery_, LV_SYMBOL_BATTERY_1); + lv_label_set_text(battery_, ">70"); } else if (state.battery_percent >= 40) { - lv_label_set_text(battery_, LV_SYMBOL_BATTERY_2); + lv_label_set_text(battery_, ">40"); } else if (state.battery_percent >= 10) { - lv_label_set_text(battery_, LV_SYMBOL_BATTERY_3); + lv_label_set_text(battery_, ">10"); } else { - lv_label_set_text(battery_, LV_SYMBOL_BATTERY_EMPTY); + lv_label_set_text(battery_, "0"); } }