diff --git a/cores/esp8266/Updater.cpp b/cores/esp8266/Updater.cpp index b2e92978eb..d9d468765a 100644 --- a/cores/esp8266/Updater.cpp +++ b/cores/esp8266/Updater.cpp @@ -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){ diff --git a/cores/esp8266/Updater.h b/cores/esp8266/Updater.h index 30c4a0071f..14a4a3baa9 100644 --- a/cores/esp8266/Updater.h +++ b/cores/esp8266/Updater.h @@ -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