Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move SPIFFS to LittleFS for ESP8266 #1226

Merged
merged 17 commits into from
Aug 12, 2020
Merged

move SPIFFS to LittleFS for ESP8266 #1226

merged 17 commits into from
Aug 12, 2020

Conversation

Caffreyfans
Copy link
Contributor

I only replace SPIFFS.open() and SPIFFS.begin() by LittleFS for ESP8266.

@Caffreyfans
Copy link
Contributor Author

Why change directory upload to directory data. Please see link below.They can upload by esptool.
uploading-files-to-filesystem

Copy link
Contributor Author

@Caffreyfans Caffreyfans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No errors found

@crankyoldgit
Copy link
Owner

Why change directory upload to directory data. Please see link below.They can upload by esptool.
uploading-files-to-filesystem

I didn't write the code for Web-AC-control.ino, some other author did. i.e. it was use submitted.
If you want to change it to something more "standard", feel free to.

examples/IRMQTTServer/IRMQTTServer.h Show resolved Hide resolved
Comment on lines 383 to 385



Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: These blank lines can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already edited. 👍

//
// Returns:
// A boolean indicating success or failure.
bool mountSpiffs(void) {
debug("Mounting SPIFFS...");
if (SPIFFS.begin()) return true; // We mounted it okay.
debug("Mounting FILESYSTEM...");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug("Mounting " FILESYSTEM "...");
Use that instead, and it should report if it is SPIFFS or LittleFS etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already change to:

#if (FILESYSTEM == LittleFS)
    debug("... LittleFS ...");
#else
    debug("... SPIFSS ..."0;
#endif

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use my suggestion, then you don't need the #if clause and it works for any other type of FS.

Comment on lines 528 to 529
debug("Failed to mount FILESYSTEM!\n"
"Formatting FILESYSTEM and trying again...");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  debug("Failed to mount " FILESYSTEM "!\n"
        "Formatting " FILESYSTEM " and trying again...");

Use that instead, and it should report if it is SPIFFS or LittleFS etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

"Formatting FILESYSTEM and trying again...");
FILESYSTEM.format();
if (!FILESYSTEM.begin()) { // Did we fail?
debug("DANGER: Failed to mount FILESYSTEM even after formatting!");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug("DANGER: Failed to mount " FILESYSTEM " even after formatting!");
Use that instead, and it should report if it is SPIFFS or LittleFS etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

// Open the file
server.streamFile(file, contentType);
// Send it to the client
file.close();
// Close the file again
// Serial.println(String("\tSent file: ") + path);
Serial.println(String("\tSent file: ") + path);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. You're changing the behaviour by adding in the debug messages. Is that something you mean to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-comment.

return true;
}
// Serial.println(String("\tFile Not Found: ") + path);
Serial.println(String("\tFile Not Found: ") + path);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-comment.

Comment on lines 128 to 129
// Serial.print("handleFileUpload Size: ");
// Serial.println(upload.totalSize);
Serial.print("handleFileUpload Size: ");
Serial.println(upload.totalSize);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-comment.

Comment on lines 156 to 158
// Serial.begin(115200);
// Serial.println();
Serial.begin(115200);
Serial.println();
ac.begin();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-comment.

// Serial.println("mounting FS...");
Serial.println("mounting FS...");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-comment.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't appear to have been updated.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you git push?

Copy link
Owner

@crankyoldgit crankyoldgit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crankyoldgit crankyoldgit merged commit a6cd2ac into crankyoldgit:master Aug 12, 2020
crankyoldgit added a commit that referenced this pull request Aug 31, 2020
_v2.7.10 (20200831)_

**[BREAKING CHANGES]**
- move SPIFFS to LittleFS for ESP8266 (#1182 #1226)
- Daikin176: Change & increase operating mode values. (#1233 #1235)

**[Bug Fixes]**
- TOSHIBA_AC: not turning off when using `IRac` class. (#1250 #1251)
- Haier: change position of Fan speed bits. (#1246 #1247)

**[Features]**
- Voltas: Add detailed support for Voltas A/Cs (#1238 #1248)
- Add support for Metz protocol. (#1241 #1242)
- Basic support for Voltas A/C protocol (#1238 #1243)
- Add low level bit formatting sanity checks. (#1232)

**[Misc]**
- Rewrite Airwell by using bit fields (#1254)
- Rewrite Haier YRW02 using bit fields (#1253)
- rewrite Haier HSU07-HEA03 (#1246 #1247)
- rewrite ir_Gree & ir_Midea by using bit field (#1240)
- Incorrect usage of `assert()` (#1244 #1245 #1232)
- rewrite Gree (#1210)
@crankyoldgit crankyoldgit mentioned this pull request Aug 31, 2020
crankyoldgit added a commit that referenced this pull request Aug 31, 2020
## v2.7.10 release
_v2.7.10 (20200831)_

**[BREAKING CHANGES]**
- move SPIFFS to LittleFS for ESP8266 (#1182 #1226)
- Daikin176: Change & increase operating mode values. (#1233 #1235)

**[Bug Fixes]**
- TOSHIBA_AC: not turning off when using `IRac` class. (#1250 #1251)
- Haier: change position of Fan speed bits. (#1246 #1247)

**[Features]**
- Voltas: Add detailed support for Voltas A/Cs (#1238 #1248)
- Add support for Metz protocol. (#1241 #1242)
- Basic support for Voltas A/C protocol (#1238 #1243)
- Add low level bit formatting sanity checks. (#1232)

**[Misc]**
- Rewrite Airwell by using bit fields (#1254)
- Rewrite Haier YRW02 using bit fields (#1253)
- rewrite Haier HSU07-HEA03 (#1246 #1247)
- rewrite ir_Gree & ir_Midea by using bit field (#1240)
- Incorrect usage of `assert()` (#1244 #1245 #1232)
- rewrite Gree (#1210)
@crankyoldgit
Copy link
Owner

The code changes mention have now been included in the newly released v2.7.10 of the library.

@sblantipodi
Copy link

thanks for your work here @crankyoldgit
why this change is marked as breaking changes?

what should I do before upgrading to 2.7.10?
thanks
Davide

@crankyoldgit
Copy link
Owner

It's only a breaking change for two of the code examples. IRMQTTServer and Web-AC-Control.

For those two examples, LittleFS is enabled as a (default) replacement/alternative to SPIFFS for the local file system on ESP8266s.
You can choose SPIFFS as the default to retain backward compatiblity.
See:

// Uncomment one of the following to manually override what
// type of persistent storage is used.
// Warning: Changing filesystems will cause all previous locally
// saved configuration data to be lost.
// #define FILESYSTEM SPIFFS
// #define FILESYSTEM LittleFS
#ifndef FILESYSTEM
// Set the default filesystem if none was specified.
#ifdef ESP8266
#define FILESYSTEM LittleFS
#else
#define FILESYSTEM SPIFFS
#endif // defined(ESP8266)
#endif // FILESYSTEM

If you choose to use LittleFS instead of SPIFFS it will wipe any locally stored information in the local filesystem of the ESP chip.
e.g. Config file for IRMQTTServer and uploaded (web) files for Web-AC-Control

SPIFFS is now deprecated in the ESP8266 Core library due to it no longer being maintained AFAIK, LittleFS is a drop-in replacement, but completely different format, so it will format the data partition on first use.

So, what do you need to do? Backup/record any config/settings and be prepared to have to do the initial setup of any ESP running IRMQTTServer, and re-upload any files you uploaded to Web-AC-Control

@crankyoldgit
Copy link
Owner

I've made this (I hope) clearer (scope-wise) in the ReleaseNotes.md file, and on the page for the v2.7.10 release pointing to your/this question etc.

@sblantipodi
Copy link

ok thanks for the answer 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants