Add spiffsInfo

This commit is contained in:
fvanroie 2020-04-02 16:50:17 +02:00
parent 507e455f7e
commit f1a3e782da
2 changed files with 57 additions and 4 deletions

View File

@ -12,6 +12,62 @@
#include <FS.h> #include <FS.h>
#endif #endif
void spiffsInfo()
{ // Get all information of your SPIFFS
#if defined(ARDUINO_ARCH_ESP8266)
FSInfo fs_info;
SPIFFS.info(fs_info);
Serial.println("File sistem info.");
Serial.print("Total space: ");
Serial.print(fs_info.totalBytes);
Serial.println("byte");
Serial.print("Total space used: ");
Serial.print(fs_info.usedBytes);
Serial.println("byte");
Serial.print("Block size: ");
Serial.print(fs_info.blockSize);
Serial.println("byte");
Serial.print("Page size: ");
Serial.print(fs_info.totalBytes);
Serial.println("byte");
Serial.print("Max open files: ");
Serial.println(fs_info.maxOpenFiles);
Serial.print("Max path lenght: ");
Serial.println(fs_info.maxPathLength);
#else
Serial.println("File sistem info.");
Serial.print("Total space: ");
Serial.print(SPIFFS.totalBytes());
Serial.println("byte");
Serial.print("Total space used: ");
Serial.print(SPIFFS.usedBytes());
Serial.println("byte");
Serial.print("Block size: ");
// Serial.print(SPIFFS);
Serial.println("byte");
Serial.print("Page size: ");
Serial.print(SPIFFS.totalBytes());
Serial.println("byte");
Serial.print("Max open files: ");
// Serial.println(SPIFFS.maxOpenFiles());
Serial.print("Max path lenght: ");
// Serial.println(SPIFFS.maxPathLength());
#endif
}
void spiffsList() void spiffsList()
{ {
Log.verbose(F("FILE: Listing files on the internal flash:")); Log.verbose(F("FILE: Listing files on the internal flash:"));
@ -49,9 +105,6 @@ void spiffsSetup()
#endif #endif
} }
void spiffsLoop()
{}
String spiffsFormatBytes(size_t bytes) String spiffsFormatBytes(size_t bytes)
{ {
String output((char *)0); String output((char *)0);

View File

@ -4,9 +4,9 @@
#include <Arduino.h> #include <Arduino.h>
void spiffsSetup(void); void spiffsSetup(void);
void spiffsLoop(void);
void spiffsList(); void spiffsList();
void spiffsInfo();
String spiffsFormatBytes(size_t bytes); String spiffsFormatBytes(size_t bytes);
#endif #endif