bitbank2 / JPEGDEC

An optimized JPEG decoder suitable for microcontrollers and PCs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adafruit GFX from SD

el-samiyel opened this issue · comments

Hi, great work and thanks for sharing.

Are you able to point me in the right direction as to how I can get this to run on the Adafruit GFX libs and read the image from an SD.

After many attempts, I get it to recognise the images on the SD, but they do not display on the ili9341.

I am actually using a teensy 4, however I am unable to use ILI9341_t3.h without having to re-write much of my existing project which is based off of the GFX libs. (The t3 slideshow example works)

Any help/direction will be most appreciated.

Are you able to use the adafruit_gfx_demo sketch as a guide?
(https://github.com/bitbank2/JPEGDEC/tree/master/examples/adafruit_gfx_demo)

Check return codes - you many be trying to display a progressive JPEG. It needs to be baseline

image_to_c works correctly. I can't debug the problem with the little bit of info you provided. Return codes to check are from the JPEGDEC class methods. I can take a look if you share the actual code you're using. I know my library works reliably, so it's highly likely that you made a simple mistake in your code.

Understood, yes probably me doing something wrong.

Code attached. Id appreciate your feedback.

When I run under thumb_test,h it works fine, and the images change as expected. When I replace with b.h or c.h, i get a blank screen..

adafruit_gfx_demo_issue.zip

Here are the images I was testing with using (image_to_c64.exe):

images.zip

Ideally, as per my original post, id like to load the images directly from the SD, without the need to convert them using the tool. But my attempt at a conversion from the ili9341_t3_slideshow to using the adafruit libs also failed. I'm presented with the jpeg files being read out on the display in yellow, but no images on the screen.

Code also attached for your consideration. I am probably missing something silly.

adafruit_from_sd_attempt_slideshow.zip

Many Thanks

The image_to_c tool allows you to link image data into your sketch as "const" data in FLASH. It has nothing to do with image data loaded from media at run time.

The image_to_c tool allows you to link image data into your sketch as "const" data in FLASH. It has nothing to do with image data loaded from media at run time.

Understood, yes I was saying that I tried both ways. Loading from flash using the image_to_c tool, and I tried to load from the SD as it was done in the ili9341 teensy slid show example.

I get a black screen when loading from flash, as per my 1st attachment. (works fine with thums.h but not with any jpg code I generate using the tool)

I get a black screen while trying to load from the SD as per my 3rd attachment. (works with ili9341_t3.h but not with the adafruit ili9341 lib)

Thanks

You're not checking any return codes. You're not checking the image dimensions after a successful open. You also forgot to issue a tft.startWrite() before accessing the LCD. By not activating the CS line of the LCD, all writes will be ignored.

You're not checking any return codes. You're not checking the image dimensions after a successful open. You also forgot to issue a tft.startWrite() before accessing the LCD. By not activating the CS line of the LCD, all writes will be ignored.

Hi, I still don't understand how to check the return codes. do you have an example?

See

if (jpeg.openFLASH((uint8_t *)images[i], imageLengths[i], JPEGDraw))

If an error occurs on JPEG.open or JPEG.decode you can call getLastError() to see what went wrong.

See

if (jpeg.openFLASH((uint8_t *)images[i], imageLengths[i], JPEGDraw))

If an error occurs on JPEG.open or JPEG.decode you can call getLastError() to see what went wrong.

Splendid, got it. Cheers Larry.

Thanks for taking the time to help me think.

Many Thanks