Skip to content

Commit 0c0bd86

Browse files
authored
Backport: ArduinoOTA upload intermittent failure fixed (#9215)
* Backport: ArduinoOTA upload intermittent failure fixed Backport of #4657 * Fix compile error
1 parent fda21f3 commit 0c0bd86

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: libraries/ArduinoOTA/src/ArduinoOTA.cpp

+4
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)