ArduinoOTA upload intermittent failure fixed (#4657)
* OTA upload often fails when client.read() return -1 and we subsequently try to write 4 gigabytes to flash. Fixed by signed comparison and retry. * Delay of 1ms already solves the issue * Update libraries/ArduinoOTA/src/ArduinoOTA.cpp Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> --------- Co-authored-by: Leif <git@leif.lc> Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
This commit is contained in:
parent
f764af0d1c
commit
77b64506a6
1 changed files with 4 additions and 0 deletions
|
|
@ -315,6 +315,10 @@ void ArduinoOTAClass::_runUpdate() {
|
|||
size_t r = client.read(buf, available);
|
||||
if(r != available){
|
||||
log_w("didn't read enough! %u != %u", r, available);
|
||||
if((int32_t) r<0) {
|
||||
delay(1);
|
||||
continue; //let's not try to write 4 gigabytes when client.read returns -1
|
||||
}
|
||||
}
|
||||
|
||||
written = Update.write(buf, r);
|
||||
|
|
|
|||
Loading…
Reference in a new issue