summaryrefslogtreecommitdiff
path: root/src/system_fsm/running.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/system_fsm/running.cpp')
-rw-r--r--src/system_fsm/running.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/system_fsm/running.cpp b/src/system_fsm/running.cpp
index e42429e7..70b4e99c 100644
--- a/src/system_fsm/running.cpp
+++ b/src/system_fsm/running.cpp
@@ -35,6 +35,15 @@ void Running::entry() {
auto storage_res = drivers::SdStorage::Create(sServices->gpios());
if (storage_res.has_error()) {
ESP_LOGW(kTag, "failed to mount!");
+ switch (storage_res.error()) {
+ case drivers::SdStorage::FAILED_TO_MOUNT:
+ sServices->sd(drivers::SdState::kNotFormatted);
+ break;
+ case drivers::SdStorage::FAILED_TO_READ:
+ default:
+ sServices->sd(drivers::SdState::kNotPresent);
+ break;
+ }
events::System().Dispatch(StorageError{});
events::Audio().Dispatch(StorageError{});
@@ -42,6 +51,7 @@ void Running::entry() {
return;
}
sStorage.reset(storage_res.value());
+ sServices->sd(drivers::SdState::kMounted);
ESP_LOGI(kTag, "opening database");
sFileGatherer = new database::FileGathererImpl();