File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
components/esp_peripherals Expand file tree Collapse file tree 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";
4343
4444#define tick_get periph_tick_get
4545
46-
4746static esp_err_t periph_sdcard_mount (esp_periph_handle_t periph );
4847static esp_err_t periph_sdcard_unmount (esp_periph_handle_t periph );
4948
50-
5149typedef struct {
5250 char * root ;
5351 int card_detect_pin ;
@@ -106,13 +104,15 @@ static esp_err_t _sdcard_destroy(esp_periph_handle_t self)
106104{
107105 VALIDATE_SDCARD (self , ESP_FAIL );
108106 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+ }
111112 ret |= sdcard_destroy ();
112113 if (ret != ESP_OK ) {
113114 ESP_LOGE (TAG , "stop sdcard error!" );
114115 }
115- periph_sdcard_t * sdcard = esp_periph_get_data (self );
116116 esp_periph_stop_timer (self );
117117 audio_free (sdcard -> root );
118118 audio_free (sdcard );
You can’t perform that action at this time.
0 commit comments