Skip to content
Snippets Groups Projects
Commit 70cfce2b authored by q3k's avatar q3k
Browse files

st3m/audio: more graceful raed error handling

Short reads generally shouldn't happen, but let's be defensive there.

Instead, let's explicitly check the return code of i2s reads.

Brought to you by: “my interrupt didn't get initialized and i got very
confused”.
parent 0377cc49
No related branches found
No related tags found
No related merge requests found
Pipeline #5964 passed
......@@ -296,11 +296,16 @@ static void _audio_player_task(void *data) {
while (true) {
count = 0;
flow3r_bsp_audio_read(buffer_rx, sizeof(buffer_rx), &count, 1000);
esp_err_t ret =
flow3r_bsp_audio_read(buffer_rx, sizeof(buffer_rx), &count, 1000);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "audio_read: %s", esp_err_to_name(ret));
abort();
}
if (count != sizeof(buffer_rx)) {
ESP_LOGE(TAG, "audio_read: count (%d) != length (%d)\n", count,
sizeof(buffer_rx));
abort();
continue;
}
LOCK;
......@@ -574,4 +579,4 @@ DISPATCH_TY_TY(float, float, set_volume_dB)
DISPATCH_TY_VOID(float, get_volume_dB)
DISPATCH_VOID_TY(bool, set_mute)
DISPATCH_TY_VOID(bool, get_mute)
DISPATCH_TY_VOID(float, get_volume_relative)
\ No newline at end of file
DISPATCH_TY_VOID(float, get_volume_relative)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment