diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-03-20 11:08:35 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-03-20 11:08:35 +1100 |
| commit | 4cd3c187f92d8f5b73c2c985da308280c18465cf (patch) | |
| tree | f4c9dd27fa3c760aab4d5b29bb442588e2ad643f /src/ui | |
| parent | edd5eecc14bd5f7f25446555459836dd10f2af33 (diff) | |
| download | tangara-fw-4cd3c187f92d8f5b73c2c985da308280c18465cf.tar.gz | |
Add exact display size to nvs, since it can vary
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/include/ui_fsm.hpp | 2 | ||||
| -rw-r--r-- | src/ui/ui_fsm.cpp | 16 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/ui/include/ui_fsm.hpp b/src/ui/include/ui_fsm.hpp index 07937559..579cc2bb 100644 --- a/src/ui/include/ui_fsm.hpp +++ b/src/ui/include/ui_fsm.hpp @@ -36,7 +36,7 @@ namespace ui { class UiState : public tinyfsm::Fsm<UiState> { public: - static auto InitBootSplash(drivers::IGpios&) -> bool; + static auto InitBootSplash(drivers::IGpios&, drivers::NvsStorage&) -> bool; virtual ~UiState() {} diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp index 1a9f01b4..0ed012a0 100644 --- a/src/ui/ui_fsm.cpp +++ b/src/ui/ui_fsm.cpp @@ -12,6 +12,7 @@ #include "bluetooth_types.hpp" #include "db_events.hpp" +#include "display_init.hpp" #include "freertos/portmacro.h" #include "freertos/projdefs.h" #include "lua.h" @@ -284,10 +285,21 @@ lua::Property UiState::sLockSwitch{false}; lua::Property UiState::sDatabaseUpdating{false}; -auto UiState::InitBootSplash(drivers::IGpios& gpios) -> bool { +auto UiState::InitBootSplash(drivers::IGpios& gpios, drivers::NvsStorage& nvs) + -> bool { // Init LVGL first, since the display driver registers itself with LVGL. lv_init(); - sDisplay.reset(drivers::Display::Create(gpios, drivers::displays::kST7735R)); + + drivers::displays::InitialisationData init_data = drivers::displays::kST7735R; + + // HACK: correct the display size for our prototypes. + // nvs.DisplaySize({161, 130}); + + auto actual_size = nvs.DisplaySize(); + init_data.width = actual_size.first.value_or(init_data.width); + init_data.height = actual_size.second.value_or(init_data.height); + + sDisplay.reset(drivers::Display::Create(gpios, init_data)); if (sDisplay == nullptr) { return false; } |
