Skip to content

SD.exists("/") works faulty #3603

Closed
@dsyleixa

Description

@dsyleixa

edit: the following issue is caused by dedicated ESP SD libs, not by the original Arduino libs (just tested):

SD.exists("/") works faulty!
If the SD has been started correctly by SD.begin(SD_CS) and the SD should be checked if intermediately mistakenly removed, it always shows "OK" and never shows an error:

 #include <SD.h>

void loop() {
   //...
   if( SD.exists("/") ) {
      Serial.println(" SD path '/' OK!  ");  // either if SD inserted or removed !!!
      // debug
      delay(2000);
   }
   else {
      Serial.println( "error! no SD file path found!  "); 
      // debug
      delay(2000);
   }
   //...
}

Arduino IDE 1.8.9
ESP32 board 1.0.4
default settings

PS:
the SD needs to be checked by the root path
SD.exists("/")
because the current files on the SD are unknown, So finally the root path is the only path which is existing on either formatted SD.
OTOH, SD.begin() also always returns no error if the SD is mistakenly not present any more.
Additionally, if no SD was inserted at the start (SD.begin() fails at setup() ), then a later re-inserting during runtime plus an extra SD.begin() also does not restart and reload the SD contents

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions