mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-25 20:02:37 +03:00
Receiving no data in Updater is an error (#7729)
Fixes #7721 by adding a new error code for when Update::end is called without any progress at all being made (i.e. no data actually ::write() to the Update object.
This commit is contained in:
parent
cfd9a34c49
commit
2e4563c76b
@ -203,6 +203,11 @@ bool UpdaterClass::end(bool evenIfRemaining){
|
||||
return false;
|
||||
}
|
||||
|
||||
// Updating w/o any data is an error we detect here
|
||||
if (!progress()) {
|
||||
_setError(UPDATE_ERROR_NO_DATA);
|
||||
}
|
||||
|
||||
if(hasError() || (!isFinished() && !evenIfRemaining)){
|
||||
#ifdef DEBUG_UPDATER
|
||||
DEBUG_UPDATER.printf_P(PSTR("premature end: res:%u, pos:%zu/%zu\n"), getError(), progress(), _size);
|
||||
@ -551,6 +556,8 @@ void UpdaterClass::printError(Print &out){
|
||||
out.println(F("Bad Size Given"));
|
||||
} else if(_error == UPDATE_ERROR_STREAM){
|
||||
out.println(F("Stream Read Timeout"));
|
||||
} else if(_error == UPDATE_ERROR_NO_DATA){
|
||||
out.println(F("No data supplied"));
|
||||
} else if(_error == UPDATE_ERROR_MD5){
|
||||
out.printf_P(PSTR("MD5 Failed: expected:%s, calculated:%s\n"), _target_md5.c_str(), _md5.toString().c_str());
|
||||
} else if(_error == UPDATE_ERROR_SIGN){
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define UPDATE_ERROR_MAGIC_BYTE (10)
|
||||
#define UPDATE_ERROR_BOOTSTRAP (11)
|
||||
#define UPDATE_ERROR_SIGN (12)
|
||||
#define UPDATE_ERROR_NO_DATA (13)
|
||||
|
||||
#define U_FLASH 0
|
||||
#define U_FS 100
|
||||
|
Loading…
x
Reference in New Issue
Block a user