File tree 1 file changed +5
-5
lines changed
components/esp_peripherals
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -43,11 +43,9 @@ static const char *TAG = "PERIPH_SDCARD";
43
43
44
44
#define tick_get periph_tick_get
45
45
46
-
47
46
static esp_err_t periph_sdcard_mount (esp_periph_handle_t periph );
48
47
static esp_err_t periph_sdcard_unmount (esp_periph_handle_t periph );
49
48
50
-
51
49
typedef struct {
52
50
char * root ;
53
51
int card_detect_pin ;
@@ -106,13 +104,15 @@ static esp_err_t _sdcard_destroy(esp_periph_handle_t self)
106
104
{
107
105
VALIDATE_SDCARD (self , ESP_FAIL );
108
106
esp_err_t ret = ESP_OK ;
109
-
110
- ret |= sdcard_unmount ();
107
+ periph_sdcard_t * sdcard = esp_periph_get_data (self );
108
+ if (sdcard -> is_mounted ) {
109
+ ret |= sdcard_unmount ();
110
+ sdcard -> is_mounted = false;
111
+ }
111
112
ret |= sdcard_destroy ();
112
113
if (ret != ESP_OK ) {
113
114
ESP_LOGE (TAG , "stop sdcard error!" );
114
115
}
115
- periph_sdcard_t * sdcard = esp_periph_get_data (self );
116
116
esp_periph_stop_timer (self );
117
117
audio_free (sdcard -> root );
118
118
audio_free (sdcard );
You can’t perform that action at this time.
0 commit comments