diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-04-09 11:44:20 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-04-09 11:44:20 +1000 |
| commit | e5c6ffdb8b3f1a1a725b387283fdf14f463a8a44 (patch) | |
| tree | 4fd853f36abf8bc46c5d4e4601d3bff52095f60f /src/audio | |
| parent | f93e3c1c69f90fcb963840f8b3a9592c35bd096b (diff) | |
| download | tangara-fw-e5c6ffdb8b3f1a1a725b387283fdf14f463a8a44.tar.gz | |
Unmount storage when there's a bad error
Diffstat (limited to 'src/audio')
| -rw-r--r-- | src/audio/fatfs_source.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/audio/fatfs_source.cpp b/src/audio/fatfs_source.cpp index 4fc5adbb..72c3940d 100644 --- a/src/audio/fatfs_source.cpp +++ b/src/audio/fatfs_source.cpp @@ -12,11 +12,13 @@ #include <memory> #include "esp_log.h" +#include "event_queue.hpp" #include "ff.h" #include "audio_source.hpp" #include "codec.hpp" #include "spi.hpp" +#include "system_events.hpp" #include "types.hpp" namespace audio { @@ -39,7 +41,7 @@ auto FatfsSource::Read(cpp::span<std::byte> dest) -> ssize_t { UINT bytes_read = 0; FRESULT res = f_read(file_.get(), dest.data(), dest.size(), &bytes_read); if (res != FR_OK) { - ESP_LOGE(kTag, "error reading from file"); + events::System().Dispatch(system_fsm::StorageError{.error = res}); return -1; } return bytes_read; |
