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

[Fix] Backing up EEPROM before performing OTA For fixing - [#1808] #1809

Merged
merged 3 commits into from
Jul 17, 2019

Conversation

arihantdaga
Copy link
Contributor

This is for taking backup of eeprom into last sector (base sector) before updating the firmware. Is helpful for builds with no SPIFFS.

Copy link
Collaborator

@mcspr mcspr left a 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)

@@ -145,6 +145,7 @@ void nofussSetup() {
#if WEB_SUPPORT
wsSend_P(PSTR("{\"action\": \"reload\"}"));
#endif
eepromBackup(0);
Copy link
Collaborator

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

@arihantdaga
Copy link
Contributor Author

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.
I'll do another commit and fix everything.

@mcspr
Copy link
Collaborator

mcspr commented Jul 7, 2019

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)

@mcspr mcspr merged commit fbf2b71 into xoseperez:dev Jul 17, 2019
@mcspr
Copy link
Collaborator

mcspr commented Jul 17, 2019

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.
There a small unrelated fixes pending too, so I wanted to merge this right now. Thanks for pointing out the issue!

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

Successfully merging this pull request may close these issues.

None yet

2 participants