File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
hardware/esp8266com/esp8266/cores/esp8266 Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ bool UpdaterClass::_writeBuffer(){
106
106
interrupts ();
107
107
if (rc) {
108
108
_error = UPDATE_ERROR_WRITE;
109
+ _currentAddress = (_startAddress + _size);
109
110
#ifdef DEBUG_UPDATER
110
111
printError (DEBUG_UPDATER);
111
112
#endif
@@ -157,6 +158,7 @@ size_t UpdaterClass::writeStream(Stream &data){
157
158
toRead = data.readBytes (_buffer + _bufferLen, toRead);
158
159
if (toRead == 0 ){ // Timeout
159
160
_error = UPDATE_ERROR_STREAM;
161
+ _currentAddress = (_startAddress + _size);
160
162
#ifdef DEBUG_UPDATER
161
163
printError (DEBUG_UPDATER);
162
164
#endif
Original file line number Diff line number Diff line change @@ -57,10 +57,10 @@ class UpdaterClass {
57
57
void clearError (){ _error = UPDATE_ERROR_OK; }
58
58
bool hasError (){ return _error != UPDATE_ERROR_OK; }
59
59
bool isRunning (){ return _size > 0 ; }
60
- bool isFinished (){ return hasError ()? true :( _currentAddress == (_startAddress + _size) ); }
60
+ bool isFinished (){ return _currentAddress == (_startAddress + _size); }
61
61
size_t size (){ return _size; }
62
62
size_t progress (){ return _currentAddress - _startAddress; }
63
- size_t remaining (){ return hasError ()? 0 :( size () - progress () ); }
63
+ size_t remaining (){ return _size - (_currentAddress - _startAddress ); }
64
64
65
65
/*
66
66
Template to write from objects that expose
@@ -116,4 +116,4 @@ class UpdaterClass {
116
116
117
117
extern UpdaterClass Update;
118
118
119
- #endif
119
+ #endif
You can’t perform that action at this time.
0 commit comments