diff --git a/src/modules/ota_update.cpp b/src/modules/ota_update.cpp index 03824da..5fb82c7 100644 --- a/src/modules/ota_update.cpp +++ b/src/modules/ota_update.cpp @@ -315,7 +315,11 @@ static bool writeImage(const manifest_t& m, const esp_partition_t* part) { while (ok && got < m.size) { size_t avail = stream->available(); if (avail == 0) { - if (!http.connected() || millis() - last_rx > STALL_TIMEOUT_MS) { + // connected() can read false for a moment between TLS records, so a + // drop only counts after 2 s of silence (it aborted a download at + // 570 B once, 2026-09-26; the retry went through). + uint32_t idle = millis() - last_rx; + if ((!http.connected() && idle > 2000) || idle > STALL_TIMEOUT_MS) { print("[ota] download stalled at %lu/%lu bytes", (unsigned long)got, (unsigned long)m.size); ok = false; break;