Skip to content

Commit

Permalink
fix issue when stored position is outside of range after changing mp3…
Browse files Browse the repository at this point in the history
… file
  • Loading branch information
michaelwittig committed Jan 2, 2024
1 parent 8a45a15 commit de1b1b0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main/hoerbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,12 @@ static void rfid_task(void *arg) { // requires sound_task!
ESP_LOGI(TAG_RFID, "Previous position found for %s: %" PRId64, no, position);
audio_element_info_t info = {0};
audio_element_getinfo(fatfs_stream_reader, &info);
info.byte_pos = position;
if (position > info.total_bytes) {
ESP_LOGI(TAG_RFID, "Previous position for %s outside of total bytes: %" PRId64, no, info.total_bytes);
info.byte_pos = 0;
} else {
info.byte_pos = position;
}
audio_element_setinfo(fatfs_stream_reader, &info);
} else {
ESP_ERROR_CHECK(ret2);
Expand Down

0 comments on commit de1b1b0

Please sign in to comment.