Updated AnimatedGIF Panel
This commit is contained in:
parent
3bd87dcfd6
commit
887c60d57a
1 changed files with 26 additions and 18 deletions
|
@ -143,6 +143,8 @@ void GIFDraw(GIFDRAW *pDraw)
|
||||||
|
|
||||||
void * GIFOpenFile(const char *fname, int32_t *pSize)
|
void * GIFOpenFile(const char *fname, int32_t *pSize)
|
||||||
{
|
{
|
||||||
|
Serial.print("Playing gif: ");
|
||||||
|
Serial.println(fname);
|
||||||
f = FILESYSTEM.open(fname);
|
f = FILESYSTEM.open(fname);
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
|
@ -254,33 +256,39 @@ void setup() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
String gifDir = "/gifs"; // play all GIFs in this directory on the SD card
|
||||||
char *szDir = "/gifs"; // play all GIFs in this directory on the SD card
|
char filePath[256] = { 0 };
|
||||||
char fname[256];
|
File root, gifFile;
|
||||||
File root, temp;
|
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
while (1) // run forever
|
while (1) // run forever
|
||||||
{
|
{
|
||||||
root = FILESYSTEM.open(szDir);
|
|
||||||
|
root = FILESYSTEM.open(gifDir);
|
||||||
if (root)
|
if (root)
|
||||||
{
|
{
|
||||||
temp = root.openNextFile();
|
gifFile = root.openNextFile();
|
||||||
while (temp)
|
while (gifFile)
|
||||||
{
|
{
|
||||||
if (!temp.isDirectory()) // play it
|
if (!gifFile.isDirectory()) // play it
|
||||||
{
|
{
|
||||||
strcpy(fname, temp.name());
|
|
||||||
|
// C-strings... urghh...
|
||||||
Serial.printf("Playing %s\n", temp.name());
|
memset(filePath, 0x0, sizeof(filePath));
|
||||||
Serial.flush();
|
strcpy(filePath, gifFile.path());
|
||||||
ShowGIF((char *)temp.name());
|
|
||||||
|
// Show it.
|
||||||
|
ShowGIF(filePath);
|
||||||
|
|
||||||
}
|
}
|
||||||
temp.close();
|
gifFile.close();
|
||||||
temp = root.openNextFile();
|
gifFile = root.openNextFile();
|
||||||
}
|
}
|
||||||
root.close();
|
root.close();
|
||||||
} // root
|
} // root
|
||||||
delay(4000); // pause before restarting
|
|
||||||
|
delay(1000); // pause before restarting
|
||||||
|
|
||||||
} // while
|
} // while
|
||||||
}
|
}
|
Loading…
Reference in a new issue