summaryrefslogtreecommitdiff
path: root/src/system_fsm/booting.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-06-07 09:50:25 +1000
committerjacqueline <me@jacqueline.id.au>2023-06-07 09:50:25 +1000
commit610991455d335663de1dd6c0c6a3e0247ffd46df (patch)
tree8022526de2d30ca39386cf72d6fb5752d0c22803 /src/system_fsm/booting.cpp
parentd2e5d2ab3cff0723cd995b0fca62aeb2a681d32d (diff)
downloadtangara-fw-610991455d335663de1dd6c0c6a3e0247ffd46df.tar.gz
R4 pre-emptive bringup
Includes stripping out the IC-specific I2S stuff, and doing more manual volume control using pots
Diffstat (limited to 'src/system_fsm/booting.cpp')
-rw-r--r--src/system_fsm/booting.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/system_fsm/booting.cpp b/src/system_fsm/booting.cpp
index b14da10c..e18a8e8d 100644
--- a/src/system_fsm/booting.cpp
+++ b/src/system_fsm/booting.cpp
@@ -63,14 +63,12 @@ auto Booting::entry() -> void {
// booting. We will transition to the error state if these aren't present.
ESP_LOGI(kTag, "installing required drivers");
sSamd.reset(drivers::Samd::Create());
- auto dac_res = drivers::AudioDac::create(sGpioExpander.get());
- if (dac_res.has_error() || !sSamd || !sRelativeTouch) {
+ if (!sSamd || !sRelativeTouch) {
events::Dispatch<FatalError, SystemState, ui::UiState, audio::AudioState>(
FatalError());
return;
}
- sDac.reset(dac_res.value());
// These drivers are initialised on boot, but are recoverable (if weird) if
// they fail.
@@ -79,7 +77,11 @@ auto Booting::entry() -> void {
// All drivers are now loaded, so we can finish initing the other state
// machines.
- audio::AudioState::Init(sGpioExpander.get(), sDac, sDatabase);
+ if (!audio::AudioState::Init(sGpioExpander.get(), sDatabase)) {
+ events::Dispatch<FatalError, SystemState, ui::UiState, audio::AudioState>(
+ FatalError());
+ return;
+ }
events::Dispatch<BootComplete, SystemState, ui::UiState, audio::AudioState>(
BootComplete());