Slideshow on 1,8" SPI display stops.

Hello All.

I very new to Arduino, and wanted to make a picture slideshow on a small display,
as described on this blog
I bought a very similar display from ebay : link
and grabbed the code directly from the blog. The code is also attached here

It works for a little while, then it stops. I found that it displays 17 of each picture on the SD CARD, and
it then stops. In the code the is a line which contains a buffer, and if I change this value to something other than 20 I can either get it to display more or less than 17 pictures - but I cannot make it go on for ever like I want. Its like there is a memory leak.

I found how to skip the code where it finds the pictures on the SD CARD itself and type in the filenames directly. But that makes no difference - it still displays 17 of each and the stops (with buffer on 20)

As I wrote, I am new to Arduino, so I cant figure out what to do.

Can anyone help ?

/Kenneth

SD_und_HY_1_8_SPI_TFT.ino (6.5 KB)