Skip to content

Commit

Permalink
Fixed ESP8266 SPIFFS support.
Browse files Browse the repository at this point in the history
Sadly the API is different from all other FS implementations :(
  • Loading branch information
marcmerlin committed Apr 24, 2019
1 parent 602881c commit 73168d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion FilenameFunctions.cpp
Expand Up @@ -173,7 +173,11 @@ int openGifFilenameByIndex(const char *directoryName, int index) {
if (file) file.close();

// Attempt to open the file for reading
if (! (file = FSO.open(pathname)) ) die ("Error opening GIF file");
#ifdef ESP8266
if (! (file = SPIFFS.open(pathname, "r")) ) die ("Error opening GIF file");
#else
if (! (file = FSO.open(pathname)) ) die ("Error opening GIF file");
#endif
return 0;
}

Expand Down
6 changes: 5 additions & 1 deletion GifAnim_Impl.h
Expand Up @@ -143,7 +143,7 @@ void sav_setup() {
Serial.println("Directory listing:");
#endif

// ESP32 SPIFFS uses special directory objects
// ESP8266 SPIFFS uses special directory objects
#ifdef ESP8266
Dir dir = SPIFFS.openDir("/");
while (dir.next()) {
Expand Down Expand Up @@ -182,7 +182,11 @@ void sav_setup() {
bool sav_newgif(const char *pathname) {
if (file) file.close();
Serial.print(pathname);
#ifdef ESP8266
file = SPIFFS.open(pathname, "r");
#else
file = FSO.open(pathname);
#endif
if (!file) {
Serial.println(": Error opening GIF file");
return 1;
Expand Down

0 comments on commit 73168d4

Please sign in to comment.