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

Parsed with restyle.sh. Compile with all errors.

This commit is contained in:
sticilface 2020-11-07 19:24:31 +00:00
parent d382a33c7d
commit ee1481aa7c
4 changed files with 67 additions and 78 deletions

View File

@ -138,7 +138,7 @@ bool FSTools::moveFS(fs::FS & destinationFS)
if (f) { if (f) {
sourceFileCount++; sourceFileCount++;
sourceByteTotal += f.size(); sourceByteTotal += f.size();
_dumpFileInfo(f); //_dumpFileInfo(f);
} }
}); });
@ -207,12 +207,12 @@ uint32_t FSTools::_getSize(const FST::layout & layout)
} }
void FSTools::_dumpFileInfo(File & f) // void FSTools::_dumpFileInfo(File & f)
{ // {
if (f) { // if (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() );
} // }
} // }
bool FSTools::_copyFS(FS & sourceFS, FS & destFS) bool FSTools::_copyFS(FS & sourceFS, FS & destFS)
{ {

View File

@ -55,7 +55,6 @@ extern const layout layout_8m7m;
extern const layout layout_16m14m; extern const layout layout_16m14m;
extern const layout layout_16m15m; extern const layout layout_16m15m;
typedef std::function<void(File & f)> FileCb; typedef std::function<void(File & f)> FileCb;
@ -63,15 +62,9 @@ typedef std::function<void(File & f)> FileCb;
//376884
//376452
class FSTools { class FSTools {
public: public:
FSTools(); FSTools();
~FSTools(); ~FSTools();
bool attemptToMountFS(fs::FS & fs); bool attemptToMountFS(fs::FS & fs);
@ -84,7 +77,7 @@ public:
private: private:
uint32_t _getStartAddr(const FST::layout & layout); uint32_t _getStartAddr(const FST::layout & layout);
uint32_t _getSize(const FST::layout & layout); uint32_t _getSize(const FST::layout & layout);
void _dumpFileInfo(File & f); // void _dumpFileInfo(File & f);
bool _copyFS(FS & sourceFS, FS & destFS); bool _copyFS(FS & sourceFS, FS & destFS);
std::unique_ptr<fs::FS> _pFS; std::unique_ptr<fs::FS> _pFS;

View File

@ -14,7 +14,7 @@
about 450k for the temp file system, so if you have more data than that on your 3Mb SPIFFS it about 450k for the temp file system, so if you have more data than that on your 3Mb SPIFFS it
will fail. will fail.
*/ */
@ -39,16 +39,15 @@ const char* ssid = STASSID;
const char* password = STAPSK; 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;
} }
@ -58,8 +57,7 @@ bool migrateFS()
} }
void initWiFiOTA() void initWiFiOTA() {
{
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password); WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) { while (WiFi.waitForConnectResult() != WL_CONNECTED) {
@ -109,9 +107,9 @@ void setup() {
Serial.begin(115200); Serial.begin(115200);
Serial.println(); Serial.println();
Serial.printf("SDK Version: %s\n", ESP.getSdkVersion() ); Serial.printf("SDK Version: %s\n", ESP.getSdkVersion());
Serial.println("Core Version: " + ESP.getCoreVersion() ); Serial.println("Core Version: " + ESP.getCoreVersion());
Serial.println("Full Version: " + ESP.getFullVersion() ); Serial.println("Full Version: " + ESP.getFullVersion());
Serial.printf("Sketch size: %u\n", ESP.getSketchSize()); Serial.printf("Sketch size: %u\n", ESP.getSketchSize());
Serial.printf("Free size: %u\n", ESP.getFreeSketchSpace()); Serial.printf("Free size: %u\n", ESP.getFreeSketchSpace());

View File

@ -15,7 +15,7 @@
about 450k for the temp file system, so if you have more data than that on your 3Mb SPIFFS it about 450k for the temp file system, so if you have more data than that on your 3Mb SPIFFS it
will fail. will fail.
*/ */
@ -46,16 +46,15 @@ const char* ssid = STASSID;
const char* password = STAPSK; 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;
} }
@ -65,8 +64,7 @@ bool migrateFS()
} }
void initWiFiOTA() void initWiFiOTA() {
{
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password); WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) { while (WiFi.waitForConnectResult() != WL_CONNECTED) {
@ -116,9 +114,9 @@ void setup() {
Serial.begin(115200); Serial.begin(115200);
Serial.println(); Serial.println();
Serial.printf("SDK Version: %s\n", ESP.getSdkVersion() ); Serial.printf("SDK Version: %s\n", ESP.getSdkVersion());
Serial.println("Core Version: " + ESP.getCoreVersion() ); Serial.println("Core Version: " + ESP.getCoreVersion());
Serial.println("Full Version: " + ESP.getFullVersion() ); Serial.println("Full Version: " + ESP.getFullVersion());
Serial.printf("Sketch size: %u\n", ESP.getSketchSize()); Serial.printf("Sketch size: %u\n", ESP.getSketchSize());
Serial.printf("Free size: %u\n", ESP.getFreeSketchSpace()); Serial.printf("Free size: %u\n", ESP.getFreeSketchSpace());