Skip to content

Commit 77b6450

Browse files
leifclaessonLeiflucasssvazP-R-O-C-H-Y
authored
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 <[email protected]> --------- Co-authored-by: Leif <[email protected]> Co-authored-by: Lucas Saavedra Vaz <[email protected]> Co-authored-by: Jan Procházka <[email protected]>
1 parent f764af0 commit 77b6450

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libraries/ArduinoOTA/src/ArduinoOTA.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@ void ArduinoOTAClass::_runUpdate() {
315315
size_t r = client.read(buf, available);
316316
if(r != available){
317317
log_w("didn't read enough! %u != %u", r, available);
318+
if((int32_t) r<0) {
319+
delay(1);
320+
continue; //let's not try to write 4 gigabytes when client.read returns -1
321+
}
318322
}
319323

320324
written = Update.write(buf, r);

0 commit comments

Comments
 (0)