1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-18 12:24:04 +03:00
This commit is contained in:
david gauchard 2022-06-15 23:37:42 +02:00
parent 494e51f2bb
commit 92fed38747
2 changed files with 13 additions and 13 deletions

View File

@ -32,7 +32,7 @@ FSTools fstools;
#ifndef STASSID #ifndef STASSID
#define STASSID "xxxx" #define STASSID "xxxx"
#define STAPSK "xxxx" #define STAPSK "xxxx"
#endif #endif
const char* ssid = STASSID; const char* ssid = STASSID;
@ -40,13 +40,13 @@ const char* password = STAPSK;
bool migrateFS() { bool migrateFS() {
if (!fstools.attemptToMountFS(LittleFS)) { // Attempts to mount LittleFS without autoformat... if (!fstools.attemptToMountFS(LittleFS)) { // Attempts to mount LittleFS without autoformat...
Serial.println(F("Default FS not found")); Serial.println(F("Default FS not found"));
if (fstools.mountAlternativeFS(FST::SPIFFS /* FST::LITTLEFS */, TARGET_FS_LAYOUT, true)) { if (fstools.mountAlternativeFS(FST::SPIFFS /* FST::LITTLEFS */, TARGET_FS_LAYOUT, true)) {
Serial.println(F("Alternative found")); Serial.println(F("Alternative found"));
if (fstools.moveFS(LittleFS)) { if (fstools.moveFS(LittleFS)) {
Serial.println(F("FileSystem Moved New FS contents:")); Serial.println(F("FileSystem Moved New FS contents:"));
fstools.fileListIterator(LittleFS, "/", [](File & f) { fstools.fileListIterator(LittleFS, "/", [](File& f) {
Serial.printf_P(PSTR(" File: %-30s [%8uB]\n"), f.fullName(), f.size()); Serial.printf_P(PSTR(" File: %-30s [%8uB]\n"), f.fullName(), f.size());
}); });
return true; return true;
@ -70,7 +70,7 @@ void initWiFiOTA() {
String type; String type;
if (ArduinoOTA.getCommand() == U_FLASH) { if (ArduinoOTA.getCommand() == U_FLASH) {
type = "sketch"; type = "sketch";
} else { // U_FS } else { // U_FS
type = "filesystem"; type = "filesystem";
} }
@ -116,7 +116,7 @@ void setup() {
Serial.println("Booting"); Serial.println("Booting");
migrateFS(); // MUST call this before calling your own begin(); migrateFS(); // MUST call this before calling your own begin();
initWiFiOTA(); initWiFiOTA();

View File

@ -30,7 +30,7 @@
#define TARGET_FS_LAYOUT FST::layout_4m3m #define TARGET_FS_LAYOUT FST::layout_4m3m
const uint32_t startSector = FST::layout_4m1m.startAddr - 0x40200000; const uint32_t startSector = FST::layout_4m1m.startAddr - 0x40200000;
const uint32_t tempFSsize = FST::layout_4m1m.endAddr - FST::layout_4m1m.startAddr; const uint32_t tempFSsize = FST::layout_4m1m.endAddr - FST::layout_4m1m.startAddr;
fs::FS LittleFS_Different = FS(FSImplPtr(new littlefs_impl::LittleFSImpl(startSector, tempFSsize, FS_PHYS_PAGE, FS_PHYS_BLOCK, 5))); fs::FS LittleFS_Different = FS(FSImplPtr(new littlefs_impl::LittleFSImpl(startSector, tempFSsize, FS_PHYS_PAGE, FS_PHYS_BLOCK, 5)));
@ -39,7 +39,7 @@ FSTools fstools;
#ifndef STASSID #ifndef STASSID
#define STASSID "xxxx" #define STASSID "xxxx"
#define STAPSK "xxxx" #define STAPSK "xxxx"
#endif #endif
const char* ssid = STASSID; const char* ssid = STASSID;
@ -47,13 +47,13 @@ const char* password = STAPSK;
bool migrateFS() { bool migrateFS() {
if (!fstools.attemptToMountFS(LittleFS_Different)) { // Attempts to mount LittleFS without autoformat... if (!fstools.attemptToMountFS(LittleFS_Different)) { // Attempts to mount LittleFS without autoformat...
Serial.println(F("Default FS not found")); Serial.println(F("Default FS not found"));
if (fstools.mountAlternativeFS(FST::SPIFFS /* FST::LITTLEFS */, TARGET_FS_LAYOUT, true)) { if (fstools.mountAlternativeFS(FST::SPIFFS /* FST::LITTLEFS */, TARGET_FS_LAYOUT, true)) {
Serial.println(F("Alternative found")); Serial.println(F("Alternative found"));
if (fstools.moveFS(LittleFS_Different)) { if (fstools.moveFS(LittleFS_Different)) {
Serial.println(F("FileSystem Moved New FS contents:")); Serial.println(F("FileSystem Moved New FS contents:"));
fstools.fileListIterator(LittleFS_Different, "/", [](File & f) { fstools.fileListIterator(LittleFS_Different, "/", [](File& f) {
Serial.printf_P(PSTR(" File: %-30s [%8uB]\n"), f.fullName(), f.size()); Serial.printf_P(PSTR(" File: %-30s [%8uB]\n"), f.fullName(), f.size());
}); });
return true; return true;
@ -77,7 +77,7 @@ void initWiFiOTA() {
String type; String type;
if (ArduinoOTA.getCommand() == U_FLASH) { if (ArduinoOTA.getCommand() == U_FLASH) {
type = "sketch"; type = "sketch";
} else { // U_FS } else { // U_FS
type = "filesystem"; type = "filesystem";
} }
@ -123,7 +123,7 @@ void setup() {
Serial.println("Booting"); Serial.println("Booting");
migrateFS(); // MUST call this before calling your own begin(); migrateFS(); // MUST call this before calling your own begin();
initWiFiOTA(); initWiFiOTA();