From 0c58dc15362a8b0f25db5071bfc2d73d5c072508 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 16 Jun 2016 16:25:17 +0800 Subject: [PATCH] Updater: read data back from flash before calculating MD5 --- cores/esp8266/Updater.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cores/esp8266/Updater.cpp b/cores/esp8266/Updater.cpp index 4764742463..ca300eb846 100644 --- a/cores/esp8266/Updater.cpp +++ b/cores/esp8266/Updater.cpp @@ -202,12 +202,14 @@ bool UpdaterClass::end(bool evenIfRemaining){ } bool UpdaterClass::_writeBuffer(){ - if(!_async) yield(); bool result = ESP.flashEraseSector(_currentAddress/FLASH_SECTOR_SIZE); if(!_async) yield(); if (result) { result = ESP.flashWrite(_currentAddress, (uint32_t*) _buffer, _bufferLen); + if (result) { + result = ESP.flashRead(_currentAddress, (uint32_t*) _buffer, _bufferLen); + } } if(!_async) yield();