Bodmer / JPEGDecoder

A JPEG decoder library
Other
220 stars 64 forks source link

scrolling or slide show of the JPEGs from SPIFFS on the TFT screen #53

Closed bogus105 closed 3 years ago

bogus105 commented 3 years ago

Hi Bodmer,

thank you one more time for the library and support. I did big improvements in my firmware. The device i'm doing is driven by esp8266-12E and the screen is TFT ILI9341. The goal for me now is as follows:

  1. i'm going to put many (like 30) full screen (320x240) images in JPEG format
  2. they will serve as background
  3. during device start i'll initiate the "pick the background" function

To do number 3. i need to sort out how to scroll/slide show the photos on the TFT screen every time i press the button. And it is a problem for me as so far i can see that to decode JPEG i need to pass file name (not surprised:)) to decoding method and then push it to the screen by tft.pushImage... The chosen image (by long button press) should be 'remembered' somehow in EEPROM and should be automatically displayed on the TFT screen next time the device is switched on. So the problem i have is two fold:

  1. how to name the files stored in SPIFFS so my function will easily pick the images one by one in setup menu
  2. how to store the information in EEPROM

For 1: I was thinking to name the files like: 1.jpg, 2.jpg, 3.jpg... but i can't sort out how to construct the function to create strings(?) to 'make' a file names to be decoded. Is there any method in SPIFFS to distinguish between files without knowing their actual names? Like "next file" in SPIFFS instead of pointing to the file name? For 2: Is there a way to check the JPEG file address in SPIFFS memory so i can store this address in EEPROM instead of storing the string containing the file name? Or maybe it is the best approach to store the string and just pass the string as an argument to the decoding function on start up?

Thank you for any input:)

Bodmer commented 3 years ago

The example code for this alternative Jpeg library may help as a starting point.

That example displays a "slideshow" all jpeg files stored in SPIFFS. I think the ESP8266 does not have EEPROM, but data can be stored in SPIFFS from a sketch, see SPIFFS documentation. Clearly a menu could be created from the directory file list too.