Update: don't block the system during the Update

Too much traffic triggered the Task watchdog before under good WLAN conditions.
This commit is contained in:
Thomas Kolb 2019-12-02 20:53:21 +01:00
parent 72d0233f52
commit 1c899c1f24

View file

@ -45,10 +45,9 @@ static bool read_n(WiFiClient *client, char *buf, size_t n)
Serial.print("/"); Serial.print("/");
Serial.print(n); Serial.print(n);
Serial.println(" total)"); Serial.println(" total)");
} else {
Serial.print(".");
delay(1);
} }
delay(1); // allow other tasks to run during data reception
} }
return nread == n; return nread == n;
@ -145,9 +144,9 @@ void UpdateServer::updateTask(void *arg)
Update.write(buf, bytes_read); Update.write(buf, bytes_read);
bytes_processed += bytes_read; bytes_processed += bytes_read;
} else {
delay(1);
} }
delay(1);
} }
// all data processed? // all data processed?