mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
make Update erase/write sector by sector as well
This commit is contained in:
parent
9d0a690421
commit
703ab8df64
@ -51,18 +51,6 @@ bool UpdaterClass::begin(size_t size){
|
||||
return false;
|
||||
}
|
||||
|
||||
//erase the neede space
|
||||
noInterrupts();
|
||||
int rc = SPIEraseAreaEx(updateStartAddress, roundedSize);
|
||||
interrupts();
|
||||
if (rc){
|
||||
_error = UPDATE_ERROR_ERASE;
|
||||
#ifdef DEBUG_UPDATER
|
||||
printError(DEBUG_UPDATER);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
//initialize
|
||||
_startAddress = updateStartAddress;
|
||||
_currentAddress = _startAddress;
|
||||
@ -122,7 +110,19 @@ bool UpdaterClass::end(bool evenIfRemaining){
|
||||
bool UpdaterClass::_writeBuffer(){
|
||||
WDT_FEED();
|
||||
noInterrupts();
|
||||
int rc = SPIWrite(_currentAddress, _buffer, _bufferLen);
|
||||
int rc = SPIEraseSector(_currentAddress/FLASH_SECTOR_SIZE);
|
||||
interrupts();
|
||||
if (rc){
|
||||
_error = UPDATE_ERROR_ERASE;
|
||||
#ifdef DEBUG_UPDATER
|
||||
printError(DEBUG_UPDATER);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
WDT_FEED();
|
||||
noInterrupts();
|
||||
rc = SPIWrite(_currentAddress, _buffer, _bufferLen);
|
||||
interrupts();
|
||||
if (rc) {
|
||||
_error = UPDATE_ERROR_WRITE;
|
||||
|
@ -1,3 +1,7 @@
|
||||
/*
|
||||
To upload through terminal you can use: curl -F "image=@firmware.bin" esp8266-webupdate.local/update
|
||||
*/
|
||||
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user