Skip to content

Commit d6e4d8f

Browse files
committed
AudioSourceSDFAT: dont close sd when object is provided via constructor
1 parent c631709 commit d6e4d8f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/AudioTools/Disk/AudioSourceSDFAT.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ class AudioSourceSDFAT : public AudioSource {
8080
exension = ext;
8181
setup_index = setupIndex;
8282
is_sd_setup = true;
83+
// since we expect an open fs we do not close it
84+
is_close_sd = false;
8385
}
8486

8587
virtual ~AudioSourceSDFAT() {
@@ -102,8 +104,9 @@ class AudioSourceSDFAT : public AudioSource {
102104

103105
void end() {
104106
if (is_sd_setup) {
107+
TRACEI();
105108
#ifdef ESP32
106-
sd.end();
109+
if (is_close_sd) sd.end();
107110
#endif
108111
is_sd_setup = false;
109112
}
@@ -177,6 +180,7 @@ class AudioSourceSDFAT : public AudioSource {
177180
bool setup_index = true;
178181
bool owns_cfg = false;
179182
bool is_sd_setup = false;
183+
bool is_close_sd = true;
180184

181185
const char *getFileName(AudioFile &file) {
182186
static char name[MAX_FILE_LEN];

0 commit comments

Comments
 (0)