-
Notifications
You must be signed in to change notification settings - Fork 639
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
[Fix] Backing up EEPROM before performing OTA For fixing - [#1808] #1809
Conversation
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.
👍
You missed Arduino OTA update.
BTW, why I wanted deferred reset and eepromCommit was to delay flash write until inside loop, to allow other things to sync up. It is not super critical, but kind of requires nofuss library change so it does not reset immediately :/
edit: Which makes me think, can it do eepromCommit everywhere else but only explicitly backup in the nofuss module? (which can be changed later)
code/espurna/nofuss.ino
Outdated
@@ -145,6 +145,7 @@ void nofussSetup() { | |||
#if WEB_SUPPORT | |||
wsSend_P(PSTR("{\"action\": \"reload\"}")); | |||
#endif | |||
eepromBackup(0); |
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.
My original proposal was to insert this into the eepromRotate false condition
Yeah and i think i did another mistake also, this isnt the right place to keep eepromBackup, it should be kept in NOFUSS_UPDATING hook. |
Just to reiterate, it should do forced backup with nofuss (eepromBackup(0)) right after the rotation is disabled and there should be eepromCommit(false) in the eepromRotate (since it marks eeprom as _dirty, it will force a write next loop()). You are correct that it is better to write before any flash writes from Updater (while EEPROM buffer is in memory, just to protect from any issues during the update or other accidental failures) |
I think I covered all of the options? I have tried some builds without SPIFFS by using ArduinoOTA upgrade method (it does not leave loop(), same as nofuss) and upgrade triggered the rotation backup. |
This is for taking backup of eeprom into last sector (base sector) before updating the firmware. Is helpful for builds with no SPIFFS.