1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

Add missing "LittleFS.begin()" in LittleFS_Timestamp example. (#6762)

* Add missing "LittleFS.begin()"

Add missing first LittleFS.begin() call.

* Update LittleFS_Timestamp.ino
This commit is contained in:
Mehdi Beyk Mohamadi 2019-11-15 00:55:56 +03:30 committed by Develo
parent 48ea3a3e9e
commit 95c740705e

View File

@ -152,21 +152,25 @@ void setup() {
getLocalTime(&tmstruct, 5000); getLocalTime(&tmstruct, 5000);
Serial.printf("\nNow is : %d-%02d-%02d %02d:%02d:%02d\n", (tmstruct.tm_year) + 1900, (tmstruct.tm_mon) + 1, tmstruct.tm_mday, tmstruct.tm_hour, tmstruct.tm_min, tmstruct.tm_sec); Serial.printf("\nNow is : %d-%02d-%02d %02d:%02d:%02d\n", (tmstruct.tm_year) + 1900, (tmstruct.tm_mon) + 1, tmstruct.tm_mday, tmstruct.tm_hour, tmstruct.tm_min, tmstruct.tm_sec);
Serial.println(""); Serial.println("");
Serial.println("Formatting LittleFS filesystem");
Serial.printf("Formatting LittleFS filesystem\n");
LittleFS.format(); LittleFS.format();
Serial.println("Mount LittleFS");
if (!LittleFS.begin()) {
Serial.println("LittleFS mount failed");
return;
}
listDir("/"); listDir("/");
deleteFile("/hello.txt"); deleteFile("/hello.txt");
writeFile("/hello.txt", "Hello "); writeFile("/hello.txt", "Hello ");
appendFile("/hello.txt", "World!\n"); appendFile("/hello.txt", "World!\n");
listDir("/"); listDir("/");
Serial.printf("The timestamp should be valid above\n"); Serial.println("The timestamp should be valid above");
Serial.printf("Now unmount and remount and perform the same operation.\n"); Serial.println("Now unmount and remount and perform the same operation.");
Serial.printf("Timestamp should be valid, data should be good.\n"); Serial.println("Timestamp should be valid, data should be good.");
LittleFS.end(); LittleFS.end();
Serial.printf("Now mount it\n"); Serial.println("Now mount it");
if (!LittleFS.begin()) { if (!LittleFS.begin()) {
Serial.println("LittleFS mount failed"); Serial.println("LittleFS mount failed");
return; return;