aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authormrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2021-12-22 16:50:09 +0000
committermrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2021-12-22 16:50:09 +0000
commit887c60d57a13d71a4a49574eb27c3a5812ef98e7 (patch)
tree72c53a27f173b257cd107aae328f28278bf6dc50 /examples
parent3bd87dcfd69065acb4b5fd02403f8717ec8288d7 (diff)
Updated AnimatedGIF Panel
Diffstat (limited to 'examples')
-rw-r--r--examples/AnimatedGIFPanel/AnimatedGIFPanel.ino44
1 files changed, 26 insertions, 18 deletions
diff --git a/examples/AnimatedGIFPanel/AnimatedGIFPanel.ino b/examples/AnimatedGIFPanel/AnimatedGIFPanel.ino
index bd5c107..4e79ff1 100644
--- a/examples/AnimatedGIFPanel/AnimatedGIFPanel.ino
+++ b/examples/AnimatedGIFPanel/AnimatedGIFPanel.ino
@@ -143,6 +143,8 @@ void GIFDraw(GIFDRAW *pDraw)
void * GIFOpenFile(const char *fname, int32_t *pSize)
{
+ Serial.print("Playing gif: ");
+ Serial.println(fname);
f = FILESYSTEM.open(fname);
if (f)
{
@@ -254,33 +256,39 @@ void setup() {
}
-void loop() {
-char *szDir = "/gifs"; // play all GIFs in this directory on the SD card
-char fname[256];
-File root, temp;
+String gifDir = "/gifs"; // play all GIFs in this directory on the SD card
+char filePath[256] = { 0 };
+File root, gifFile;
+void loop()
+{
while (1) // run forever
{
- root = FILESYSTEM.open(szDir);
+
+ root = FILESYSTEM.open(gifDir);
if (root)
{
- temp = root.openNextFile();
- while (temp)
+ gifFile = root.openNextFile();
+ while (gifFile)
{
- if (!temp.isDirectory()) // play it
+ if (!gifFile.isDirectory()) // play it
{
- strcpy(fname, temp.name());
-
- Serial.printf("Playing %s\n", temp.name());
- Serial.flush();
- ShowGIF((char *)temp.name());
-
+
+ // C-strings... urghh...
+ memset(filePath, 0x0, sizeof(filePath));
+ strcpy(filePath, gifFile.path());
+
+ // Show it.
+ ShowGIF(filePath);
+
}
- temp.close();
- temp = root.openNextFile();
+ gifFile.close();
+ gifFile = root.openNextFile();
}
root.close();
} // root
- delay(4000); // pause before restarting
+
+ delay(1000); // pause before restarting
+
} // while
-}
+} \ No newline at end of file