Bodmer / JPEGDecoder

A JPEG decoder library
Other
220 stars 64 forks source link

src/JPEGDecoder.cpp #19

Closed nopnop2002 closed 5 years ago

nopnop2002 commented 6 years ago

Hello Bodmer. Thank you for your useful library.

I found wrong code. Line 348-367

And i use this library. https://github.com/greiman/SdFat

next code don't work with this library..

File pInFile = SD.open( pFilename, FILE_READ);

Next code work with this library..

File pInFile; pinFile = SD.open( pFilename, FILE_READ);

`#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 = SD.open( pFilename, FILE_READ);

return decodeSdFile(pInFile);

}

int JPEGDecoder::decodeSdFile(const String& pFilename) {

if !defined (ARDUINO_ARCH_SAM)

File pInFile = SD.open( pFilename, FILE_READ);

return decodeSdFile(pInFile);

else

return -1;

endif

}`

nopnop2002 commented 6 years ago

If you can speek Japanese, I can speek too.

Bodmer commented 6 years ago

I had a look and cannot see what change you made, also there is an error in your solution code.

pinFile should read pInFile?

What error message do you get with SdFat?

I do not speak Japanese other than the usual greeting!

nopnop2002 commented 6 years ago

Thank you for reply

If define LOAD_SDFAT_LIBRARY, int JPEGDecoder::decodeSdFile(const char *pFilename) define 2 times.

Please test in case of define LOAD_SDFAT_LIBRARY. This is your code.

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 = SD.open( pFilename, FILE_READ);

return decodeSdFile(pInFile);

}

int JPEGDecoder::decodeSdFile(const String& pFilename) { //---->>>>>

if !defined (ARDUINO_ARCH_SAM)

File pInFile = SD.open( pFilename, FILE_READ);

return decodeSdFile(pInFile);

else

return -1;

endif

}

int JPEGDecoder::decodeSdFile(File jpgFile) { // This is for the SD library

g_pInFileSd = jpgFile;

jpg_source = JPEG_SD_FILE; // Flag to indicate a SD file

if (!g_pInFileSd) {
    #ifdef DEBUG
    Serial.println("ERROR: SD file not found!");
    #endif

    return -1;
}

g_nInFileOfs = 0;

g_nInFileSize = g_pInFileSd.size();

return decodeCommon();

}

endif

Bodmer commented 6 years ago

I am not sure I understand the problem. It seems to work for me with Mega and Due. What processor are you using? What IDE version?

Can you tell me more and tell me which example fails and what the error message is.

Thanks.

nopnop2002 commented 6 years ago

I'm using STM32F103 processor. IDE version is 1.8.5 define LOAD_SDFAT_LIBRARY.

Thank you.

anlpereira commented 6 years ago

I'm using the ESP32 Wroon board. It is great. It takes about 300ms to draw a 240x320 Image on an ILI9341 2.8" display.

https://www.youtube.com/watch?v=1VqzZrW_9JY

Bodmer commented 5 years ago

This problem seems to be related to the STM32F103. I have not seen any issues with other boards.