|
|
@ -57,14 +57,19 @@ auto Booting::entry() -> void { |
|
|
|
sServices.reset(new ServiceLocator()); |
|
|
|
sServices.reset(new ServiceLocator()); |
|
|
|
|
|
|
|
|
|
|
|
ESP_LOGI(kTag, "installing early drivers"); |
|
|
|
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>(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
|
|
|
|
// I2C and SPI are both always needed. We can't even power down or show an
|
|
|
|
// error without these.
|
|
|
|
// error without these.
|
|
|
|
ESP_ERROR_CHECK(drivers::init_spi()); |
|
|
|
ESP_ERROR_CHECK(drivers::init_spi()); |
|
|
|
sServices->gpios(std::unique_ptr<drivers::Gpios>(drivers::Gpios::Create())); |
|
|
|
sServices->gpios(std::unique_ptr<drivers::Gpios>( |
|
|
|
|
|
|
|
drivers::Gpios::Create(sServices->nvs().LockPolarity()))); |
|
|
|
// NVS is needed early so that we can correctly initialise the display.
|
|
|
|
|
|
|
|
sServices->nvs( |
|
|
|
|
|
|
|
std::unique_ptr<drivers::NvsStorage>(drivers::NvsStorage::OpenSync())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ESP_LOGI(kTag, "starting ui"); |
|
|
|
ESP_LOGI(kTag, "starting ui"); |
|
|
|
if (!ui::UiState::InitBootSplash(sServices->gpios(), sServices->nvs())) { |
|
|
|
if (!ui::UiState::InitBootSplash(sServices->gpios(), sServices->nvs())) { |
|
|
@ -102,8 +107,6 @@ auto Booting::entry() -> void { |
|
|
|
sServices->bluetooth().Enable(); |
|
|
|
sServices->bluetooth().Enable(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sServices->nvs().LockPolarity(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BootComplete ev{.services = sServices}; |
|
|
|
BootComplete ev{.services = sServices}; |
|
|
|
events::Audio().Dispatch(ev); |
|
|
|
events::Audio().Dispatch(ev); |
|
|
|
events::Ui().Dispatch(ev); |
|
|
|
events::Ui().Dispatch(ev); |
|
|
|