diff options
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/include/ui_fsm.hpp | 4 | ||||
| -rw-r--r-- | src/ui/lvgl_task.cpp | 2 | ||||
| -rw-r--r-- | src/ui/ui_fsm.cpp | 11 |
3 files changed, 10 insertions, 7 deletions
diff --git a/src/ui/include/ui_fsm.hpp b/src/ui/include/ui_fsm.hpp index d4d23bb0..dda8e447 100644 --- a/src/ui/include/ui_fsm.hpp +++ b/src/ui/include/ui_fsm.hpp @@ -22,8 +22,8 @@ namespace ui { class UiState : public tinyfsm::Fsm<UiState> { public: static auto Init(drivers::GpioExpander* gpio_expander, - std::weak_ptr<drivers::RelativeWheel> touchwheel, - std::weak_ptr<drivers::Display> display) -> void; + const std::weak_ptr<drivers::RelativeWheel> &touchwheel, + const std::weak_ptr<drivers::Display> &display) -> void; virtual ~UiState() {} diff --git a/src/ui/lvgl_task.cpp b/src/ui/lvgl_task.cpp index b0e2e0ed..d70782b2 100644 --- a/src/ui/lvgl_task.cpp +++ b/src/ui/lvgl_task.cpp @@ -66,9 +66,9 @@ void LvglMain(std::weak_ptr<drivers::RelativeWheel> weak_touch_wheel, std::shared_ptr<Screen> screen = UiState::current_screen(); if (screen != current_screen && screen != nullptr) { - current_screen = screen; // TODO(jacqueline): animate this sometimes lv_scr_load(screen->root()); + current_screen = screen; } lv_task_handler(); diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp index 6d53eb45..1bc7ddb8 100644 --- a/src/ui/ui_fsm.cpp +++ b/src/ui/ui_fsm.cpp @@ -23,12 +23,16 @@ std::weak_ptr<drivers::Display> UiState::sDisplay; std::shared_ptr<Screen> UiState::sCurrentScreen; auto UiState::Init(drivers::GpioExpander* gpio_expander, - std::weak_ptr<drivers::RelativeWheel> touchwheel, - std::weak_ptr<drivers::Display> display) -> void { + const std::weak_ptr<drivers::RelativeWheel>& touchwheel, + const std::weak_ptr<drivers::Display>& display) -> void { + assert(!touchwheel.expired()); + assert(!display.expired()); sGpioExpander = gpio_expander; sTouchWheel = touchwheel; sDisplay = display; + sCurrentScreen.reset(new screens::Splash()); + StartLvgl(sTouchWheel, sDisplay); } @@ -39,7 +43,6 @@ void PreBoot::react(const system_fsm::DisplayReady& ev) { } void Splash::entry() { - sCurrentScreen.reset(new screens::Splash()); } void Splash::react(const system_fsm::BootComplete& ev) { @@ -47,7 +50,7 @@ void Splash::react(const system_fsm::BootComplete& ev) { } void Interactive::entry() { - // sCurrentScreen.reset(new screens::Menu()); + sCurrentScreen.reset(new screens::Menu()); } } // namespace states |
