I have a Mega with a Adafruit 1.8" TFT screen with Joystick and SD card interface. I have developed a simple menu system for selecting files by putting a list of up to 10 files onto the TFT at a time, and paging further lots of 10 (or less) at a time to show more files. Only 10 file names are shown at any one time (I do not want to use Folders at this stage).
I have included a shortened version below without TFT and a lot of other stuff, however it still exhibits the problem:
Each time a file is loaded (which is always successful), file name entries, up to and including the selected file are missing when the list of files is reloaded.
If the file list is reloaded 5 times consecutively it is fine, and if a selected file is loaded 5 times that is OK as well. The error only occurs when I list the files on the SD card, select one, say the first file, and load it into memory. When the list of files is fetched again, in this example the first file name will be missing from the list. If I select the third file, files 1st,2nd,3rd will be missing from the next list of files, and so on. (A dump of the serial debug is provided).
If it lies in my simplistic programming to extract names of files into a character array for use as a simple screen buffer I apologise in advance, and would appreciate any assistance in streamlining this.
If anyone can cast some light on this problem, I will be very grateful.
PS I updated my SD library to GitHub - adafruit/SD: fixes & updates to the Arduino SD library - totally in progress. works but in beta
SD_Dump.txt (3.81 KB)
SD_Tester.ino (5.1 KB)