Skip to content

Commit

Permalink
[Fix] Backing up EEPROM before performing OTA.For fixing - [xoseperez…
Browse files Browse the repository at this point in the history
  • Loading branch information
arihantdaga committed Jul 4, 2019
1 parent dc26a69 commit 4efaa78
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions code/espurna/eeprom.ino
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ void eepromCommit() {
_eeprom_commit = true;
}

void eepromBackup(uint32_t index){
EEPROMr.backup(index);
}

#if TERMINAL_SUPPORT

void _eepromInitCommands() {
Expand Down
1 change: 1 addition & 0 deletions code/espurna/nofuss.ino
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ void nofussSetup() {
#if WEB_SUPPORT
wsSend_P(PSTR("{\"action\": \"reload\"}"));
#endif
eepromBackup(0);
nice_delay(100);
}

Expand Down
1 change: 1 addition & 0 deletions code/espurna/web.ino
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ void _onUpgradeData(AsyncWebServerRequest *request, String filename, size_t inde

// Disabling EEPROM rotation to prevent writing to EEPROM after the upgrade
eepromRotate(false);
eepromBackup(0);

DEBUG_MSG_P(PSTR("[UPGRADE] Start: %s\n"), filename.c_str());
Update.runAsync(true);
Expand Down

0 comments on commit 4efaa78

Please sign in to comment.