From 4cd3c187f92d8f5b73c2c985da308280c18465cf Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 20 Mar 2024 11:08:35 +1100 Subject: Add exact display size to nvs, since it can vary --- src/system_fsm/booting.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/system_fsm/booting.cpp') diff --git a/src/system_fsm/booting.cpp b/src/system_fsm/booting.cpp index 41f46df2..14fed92e 100644 --- a/src/system_fsm/booting.cpp +++ b/src/system_fsm/booting.cpp @@ -62,8 +62,12 @@ auto Booting::entry() -> void { ESP_ERROR_CHECK(drivers::init_spi()); sServices->gpios(std::unique_ptr(drivers::Gpios::Create())); + // NVS is needed early so that we can correctly initialise the display. + sServices->nvs( + std::unique_ptr(drivers::NvsStorage::OpenSync())); + ESP_LOGI(kTag, "starting ui"); - if (!ui::UiState::InitBootSplash(sServices->gpios())) { + if (!ui::UiState::InitBootSplash(sServices->gpios(), sServices->nvs())) { events::System().Dispatch(FatalError{}); return; } @@ -74,8 +78,6 @@ auto Booting::entry() -> void { ESP_LOGI(kTag, "installing remaining drivers"); drivers::spiffs_mount(); sServices->samd(std::unique_ptr(drivers::Samd::Create())); - sServices->nvs( - std::unique_ptr(drivers::NvsStorage::OpenSync())); sServices->touchwheel( std::unique_ptr{drivers::TouchWheel::Create()}); sServices->haptics(std::make_unique()); -- cgit v1.2.3 From 46e67437717975c10c62775a3f40bec84ac4f44c Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 20 Mar 2024 11:15:33 +1100 Subject: version bump, plus prep for lock switch hack --- src/system_fsm/booting.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/system_fsm/booting.cpp') diff --git a/src/system_fsm/booting.cpp b/src/system_fsm/booting.cpp index 14fed92e..e911932c 100644 --- a/src/system_fsm/booting.cpp +++ b/src/system_fsm/booting.cpp @@ -102,7 +102,7 @@ auto Booting::entry() -> void { sServices->bluetooth().Enable(); } - sServices->nvs().LockPolarity(true); + sServices->nvs().LockPolarity(false); BootComplete ev{.services = sServices}; events::Audio().Dispatch(ev); -- cgit v1.2.3 From a05d93a1e26181237a76da5ce398c6b08497d591 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 20 Mar 2024 11:43:33 +1100 Subject: Start using the lock switch polarity bit in nvs --- src/system_fsm/booting.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/system_fsm/booting.cpp') diff --git a/src/system_fsm/booting.cpp b/src/system_fsm/booting.cpp index e911932c..eb931192 100644 --- a/src/system_fsm/booting.cpp +++ b/src/system_fsm/booting.cpp @@ -57,14 +57,19 @@ auto Booting::entry() -> void { sServices.reset(new ServiceLocator()); ESP_LOGI(kTag, "installing early drivers"); + // NVS is needed first because it contains information about what specific + // hardware configuration we're running on. + sServices->nvs( + std::unique_ptr(drivers::NvsStorage::OpenSync())); + + // HACK: fix up the switch polarity on newer dev units + sServices->nvs().LockPolarity(false); + // I2C and SPI are both always needed. We can't even power down or show an // error without these. ESP_ERROR_CHECK(drivers::init_spi()); - sServices->gpios(std::unique_ptr(drivers::Gpios::Create())); - - // NVS is needed early so that we can correctly initialise the display. - sServices->nvs( - std::unique_ptr(drivers::NvsStorage::OpenSync())); + sServices->gpios(std::unique_ptr( + drivers::Gpios::Create(sServices->nvs().LockPolarity()))); ESP_LOGI(kTag, "starting ui"); if (!ui::UiState::InitBootSplash(sServices->gpios(), sServices->nvs())) { @@ -102,8 +107,6 @@ auto Booting::entry() -> void { sServices->bluetooth().Enable(); } - sServices->nvs().LockPolarity(false); - BootComplete ev{.services = sServices}; events::Audio().Dispatch(ev); events::Ui().Dispatch(ev); -- cgit v1.2.3