Closed drp0 closed 1 year ago
I now have a
SdFat sd; // not SdFat32 sd
if (!sd.begin(SD_CONFIG)) { Serial.println(F("sd.begin failed")); return; }else Serial.println(F("SD ok"));
File something; // not File32 something
Note that JPEGDecoder.cpp does not differentiate between fat and sd. I suggest the following amendment which allows decodeSdFile to work:
#if defined (LOAD_SD_LIBRARY) || defined (LOAD_SDFAT_LIBRARY)
// Call specific to SD filing system in case leading / is used
int JPEGDecoder::decodeSdFile(const char *pFilename) {
File pInFile;
#if defined (LOAD_SD_LIBRARY)
pInFile = SD.open( pFilename, FILE_READ);
#endif
//drp
#if defined (LOAD_SDFAT_LIBRARY)
pInFile.open(pFilename, O_RDONLY);
#endif
return decodeSdFile(pInFile);
}
int JPEGDecoder::decodeSdFile(const String& pFilename) {
#if !defined (ARDUINO_ARCH_SAM)
File pInFile;
#if defined (LOAD_SD_LIBRARY)
pInFile = SD.open( pFilename.c_str(), FILE_READ);
#endif
// drp
#if defined (LOAD_SDFAT_LIBRARY)
pInFile.open(pFilename.c_str(), O_RDONLY);
#endif
return decodeSdFile(pInFile);
#else
return -1;
#endif
}
David
Thanks for the example code.
I have tried converting the library utft example to SdFat.
I edited User_Config in JPEGDecoder\src to allow #define LOAD_SDFAT_LIBRARY. I modified the example code to work with the latest SdFat version. The code will not compile with all errors pointing to SD.open in JPEGDecoder.cpp:
Basically SdFat does not recognise SD.open.. Should it be:
With this change in JPEGDecoder.cpp the example compiles but does not work.
David