Skip to content

Commit

Permalink
Cleaned up default fseq file list generation to use less ram.
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinMueller2003 committed May 28, 2024
1 parent db1ba64 commit f2d6a65
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ESPixelStick/src/FileMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ void ftp_transferCallback(FtpTransferOperation ftpOperation, const char* name, u
};
#endif // def SUPPORT_FTP

static PROGMEM const char DefaultFseqResponse[] =
"{\"totalBytes\" : 0," \
"\"files\" : []," \
"\"usedBytes\" : 0," \
"\"numFiles\" : 0" \
"}";

//-----------------------------------------------------------------------------
///< Start up the driver and put it into a safe mode
c_FileMgr::c_FileMgr ()
Expand Down Expand Up @@ -1936,15 +1943,12 @@ size_t c_FileMgr::GetDefaultFseqFileList(uint8_t * buffer, size_t maxlen)
// DEBUG_START;

memset(buffer, 0x0, maxlen);
memcpy(buffer, String(F("{\"totalBytes\" : 0," \
"\"files\" : []," \
"\"usedBytes\" : 0," \
"\"numFiles\" : 0" \
"}")).c_str(), maxlen-1);
strcpy_P((char*)&buffer[0], DefaultFseqResponse);

// DEBUG_V(String("buffer: ") + String((char*)buffer));
// DEBUG_END;
return strlen((char*)buffer);

return strlen((char*)&buffer[0]);
} // GetDefaultFseqFileList

// create a global instance of the File Manager
Expand Down

0 comments on commit f2d6a65

Please sign in to comment.