File tree 2 files changed +5
-18
lines changed
hardware/esp8266com/esp8266/cores/esp8266
2 files changed +5
-18
lines changed Original file line number Diff line number Diff line change @@ -108,23 +108,11 @@ bool UpdaterClass::end(bool evenIfRemaining){
108
108
}
109
109
110
110
bool UpdaterClass::_writeBuffer (){
111
- WDT_FEED ();
112
111
noInterrupts ();
113
112
int rc = SPIEraseSector (_currentAddress/FLASH_SECTOR_SIZE);
113
+ if (!rc) rc = SPIWrite (_currentAddress, _buffer, _bufferLen);
114
114
interrupts ();
115
115
if (rc){
116
- _error = UPDATE_ERROR_ERASE;
117
- #ifdef DEBUG_UPDATER
118
- printError (DEBUG_UPDATER);
119
- #endif
120
- return false ;
121
- }
122
-
123
- WDT_FEED ();
124
- noInterrupts ();
125
- rc = SPIWrite (_currentAddress, _buffer, _bufferLen);
126
- interrupts ();
127
- if (rc) {
128
116
_error = UPDATE_ERROR_WRITE;
129
117
_currentAddress = (_startAddress + _size);
130
118
#ifdef DEBUG_UPDATER
@@ -139,7 +127,7 @@ bool UpdaterClass::_writeBuffer(){
139
127
140
128
size_t UpdaterClass::write (uint8_t *data, size_t len){
141
129
size_t left = len;
142
- if (hasError ())
130
+ if (hasError ()||! isRunning () )
143
131
return 0 ;
144
132
145
133
if (len > remaining ())
@@ -170,7 +158,7 @@ size_t UpdaterClass::write(uint8_t *data, size_t len){
170
158
size_t UpdaterClass::writeStream (Stream &data){
171
159
size_t written = 0 ;
172
160
size_t toRead = 0 ;
173
- if (hasError ())
161
+ if (hasError ()||! isRunning () )
174
162
return 0 ;
175
163
176
164
while (remaining ()){
Original file line number Diff line number Diff line change @@ -15,9 +15,8 @@ class UpdaterClass {
15
15
public:
16
16
UpdaterClass ();
17
17
/*
18
- Call this to check and erase the space needed for the update
18
+ Call this to check the space needed for the update
19
19
Will return false if there is not enough space
20
- Or the erase of the flash failed
21
20
*/
22
21
bool begin (size_t size);
23
22
@@ -72,7 +71,7 @@ class UpdaterClass {
72
71
template <typename T>
73
72
size_t write (T &data){
74
73
size_t written = 0 ;
75
- if (hasError ())
74
+ if (hasError ()||! isRunning () )
76
75
return 0 ;
77
76
size_t available = data.available ();
78
77
while (available){
You can’t perform that action at this time.
0 commit comments