mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-21 21:22:31 +03:00
minor enchancement
This commit is contained in:
committed by
Ivan Grokhotkov
parent
ace974aede
commit
3427299065
@ -106,6 +106,7 @@ bool UpdaterClass::_writeBuffer(){
|
||||
interrupts();
|
||||
if (rc) {
|
||||
_error = UPDATE_ERROR_WRITE;
|
||||
_currentAddress = (_startAddress + _size);
|
||||
#ifdef DEBUG_UPDATER
|
||||
printError(DEBUG_UPDATER);
|
||||
#endif
|
||||
@ -157,6 +158,7 @@ size_t UpdaterClass::writeStream(Stream &data){
|
||||
toRead = data.readBytes(_buffer + _bufferLen, toRead);
|
||||
if(toRead == 0){ //Timeout
|
||||
_error = UPDATE_ERROR_STREAM;
|
||||
_currentAddress = (_startAddress + _size);
|
||||
#ifdef DEBUG_UPDATER
|
||||
printError(DEBUG_UPDATER);
|
||||
#endif
|
||||
|
@ -57,10 +57,10 @@ class UpdaterClass {
|
||||
void clearError(){ _error = UPDATE_ERROR_OK; }
|
||||
bool hasError(){ return _error != UPDATE_ERROR_OK; }
|
||||
bool isRunning(){ return _size > 0; }
|
||||
bool isFinished(){ return hasError()?true:(_currentAddress == (_startAddress + _size)); }
|
||||
bool isFinished(){ return _currentAddress == (_startAddress + _size); }
|
||||
size_t size(){ return _size; }
|
||||
size_t progress(){ return _currentAddress - _startAddress; }
|
||||
size_t remaining(){ return hasError()?0:(size() - progress()); }
|
||||
size_t remaining(){ return _size - (_currentAddress - _startAddress); }
|
||||
|
||||
/*
|
||||
Template to write from objects that expose
|
||||
@ -116,4 +116,4 @@ class UpdaterClass {
|
||||
|
||||
extern UpdaterClass Update;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user