summaryrefslogtreecommitdiff
path: root/src/system_fsm/booting.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-06-01 15:28:32 +1000
committerjacqueline <me@jacqueline.id.au>2023-06-01 15:28:54 +1000
commit6fd588e970470b15936187980829916d0dbe77bb (patch)
tree1b1e73ef52bef2e41499ee5ceadc45efd408050b /src/system_fsm/booting.cpp
parentdb2e29a72d9b934e7b58f1d20ac3768eae484ab5 (diff)
downloadtangara-fw-6fd588e970470b15936187980829916d0dbe77bb.tar.gz
Add touchwheel -> encoder adapter
Diffstat (limited to 'src/system_fsm/booting.cpp')
-rw-r--r--src/system_fsm/booting.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/system_fsm/booting.cpp b/src/system_fsm/booting.cpp
index 383bba81..b14da10c 100644
--- a/src/system_fsm/booting.cpp
+++ b/src/system_fsm/booting.cpp
@@ -13,6 +13,7 @@
#include "event_queue.hpp"
#include "gpio_expander.hpp"
#include "lvgl/lvgl.h"
+#include "relative_wheel.hpp"
#include "spi.hpp"
#include "system_events.hpp"
#include "system_fsm.hpp"
@@ -43,25 +44,28 @@ auto Booting::entry() -> void {
assert(sGpioExpander != nullptr);
// Start bringing up LVGL now, since we have all of its prerequisites.
- ESP_LOGI(kTag, "starting ui");
+ ESP_LOGI(kTag, "installing ui drivers");
lv_init();
sDisplay.reset(drivers::Display::Create(sGpioExpander.get(),
drivers::displays::kST7735R));
assert(sDisplay != nullptr);
+ sTouch.reset(drivers::TouchWheel::Create());
+ if (sTouch != nullptr) {
+ sRelativeTouch.reset(new drivers::RelativeWheel(sTouch.get()));
+ }
// The UI FSM now has everything it needs to start setting up. Do this now,
// so that we can properly show the user any errors that appear later.
- ui::UiState::Init(sGpioExpander.get(), sTouch, sDisplay, sDatabase);
+ ui::UiState::Init(sGpioExpander.get(), sRelativeTouch, sDisplay);
events::Dispatch<DisplayReady, ui::UiState>(DisplayReady());
// These drivers are required for normal operation, but aren't critical for
// booting. We will transition to the error state if these aren't present.
ESP_LOGI(kTag, "installing required drivers");
sSamd.reset(drivers::Samd::Create());
- sTouch.reset(drivers::TouchWheel::Create());
-
auto dac_res = drivers::AudioDac::create(sGpioExpander.get());
- if (dac_res.has_error() || !sSamd || !sTouch) {
+
+ if (dac_res.has_error() || !sSamd || !sRelativeTouch) {
events::Dispatch<FatalError, SystemState, ui::UiState, audio::AudioState>(
FatalError());
return;
@@ -70,7 +74,7 @@ auto Booting::entry() -> void {
// These drivers are initialised on boot, but are recoverable (if weird) if
// they fail.
- ESP_LOGI(kTag, "installing extra drivers");
+ ESP_LOGI(kTag, "installing optional drivers");
sBattery.reset(drivers::Battery::Create());
// All drivers are now loaded, so we can finish initing the other state