-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Allow SPIFFS update via ESP8266HTTPUpdateServer #3234
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
Conversation
This adds capability to update the SPIFFS image via the same mechansism as firmware in the ESP8266HTTPUpdateServer. It does not provide any dependency or linkage between firmware and spiffs image updating; they are each taken on their own, each followed by a reboot. (I wrote this before seeing the other PR for similar functionality; I like this a bit better, becaue it uses the available SPIFFS size, and does not hide magic numbers (U_SPIFFS) in the html...) (It also cleans up a stray \n from commit ace0622)
Codecov Report
@@ Coverage Diff @@
## master #3234 +/- ##
======================================
Coverage 27.6% 27.6%
======================================
Files 20 20
Lines 3655 3655
Branches 678 678
======================================
Hits 1009 1009
Misses 2468 2468
Partials 178 178 Continue to review full report at Codecov.
|
_setUpdaterError(); | ||
if (upload.name == "spiffs") { | ||
size_t spiffsSize = ((size_t) &_SPIFFS_end - (size_t) &_SPIFFS_start); | ||
if (!Update.begin(spiffsSize, U_SPIFFS)){//start with max available size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we call SPIFFS.end()
here, or check that this is done by the caller?
In this default example this is likely to be not an issue, as we are resetting after the update. But may be an issue in other scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, interesting. The README does say Use this method before updating SPIFFS using OTA.
I didn't see anything like that in ./libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp either - should it get added to both?
With my filesystem developer hat on, yes, it seems crazy to be updating the storage behind a live, mounted filesystem, but I'm not that familiar with this particular situation.
I can add it and test a bit if you like.
Thanks,
-Eric
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think SPIFFS.end
was only added recently, precisely for this use case. The libraries haven't been updated to take advantage of it, however. So updating the behavior of OTA libraries would indeed be welcome.
Any progress with this? This is a very nice feature. |
@sandeen great piece of software!!! |
</body></html>\n)"; | ||
<form method='POST' action='' enctype='multipart/form-data'> | ||
Spiffs:<br> | ||
<input type='file' name='spiffs'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about to include accept='.bin'
in both fields to filter a little?
Hi @sandeen ! |
I'm not currently working on this project and unfortunately don't have time to pick it up again right now, so I can't do proper testing a the moment. If anyone wants to take my patch as a base and get it done, go right ahead. |
OK, I'll do it! |
Seems like a reasonable, minor addition and looks like it's already in a state to use (modulo whenever LittleFS gets in and SPIFFS_end turns into FS_end). Let's consider this for 2.6. |
Closing, replaced by #3732 |
* Allow SPIFFS update via ESP8266HTTPUpdateServer This adds capability to update the SPIFFS image via the same mechansism as firmware in the ESP8266HTTPUpdateServer. It does not provide any dependency or linkage between firmware and spiffs image updating; they are each taken on their own, each followed by a reboot. (I wrote this before seeing the other PR for similar functionality; I like this a bit better, becaue it uses the available SPIFFS size, and does not hide magic numbers (U_SPIFFS) in the html...) (It also cleans up a stray \n from commit ace0622) * A simple filter * Review #3234 (review) * Including suggestions for mobile first #3961 * SPIFFS rennamed to FS * including comments from @earlephihower * button renaming * missing #include for LittleFS * generic names as suggested by @d-a-v
This adds capability to update the SPIFFS image via
the same mechanism as firmware in the
ESP8266HTTPUpdateServer.
It does not provide any dependency or linkage between
firmware and spiffs image updating; they are each taken
on their own, each followed by a reboot.
(I wrote this before seeing the other PR #2701 for similar
functionality; I like this a bit better, because it uses
the available SPIFFS size, and does not hide magic numbers
(U_SPIFFS) in the html...)
(It also cleans up a stray \n from commit ace0622)
We'd really like to see this functionality in the library for the
OpenEVSE wifi project
This is my first try at this, mostly cribbing from the ESP8266httpUpdate version of the updater - happy to fix up anything as needed.
Thanks,
-Eric