From 4a5b058c1a9f93a6cfc725b90556039bda9a4bf3 Mon Sep 17 00:00:00 2001 From: Rasmus Date: Sat, 12 Sep 2026 16:07:21 +0200 Subject: [PATCH] fix(ota): remove artificial chunk delay and enlarge buffer to prevent connection timeout --- main/ota_manager.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main/ota_manager.c b/main/ota_manager.c index 95b9941..6da17f0 100644 --- a/main/ota_manager.c +++ b/main/ota_manager.c @@ -494,9 +494,10 @@ static void ota_download_task(void *arg) esp_http_client_config_t http_cfg = { .url = s_release.download_url, .transport_type = HTTP_TRANSPORT_OVER_SSL, - .timeout_ms = 30000, + .timeout_ms = 45000, .keep_alive_enable = true, - .buffer_size = 2048, + .buffer_size = 4096, + .buffer_size_tx = 2048, .cert_pem = s_isrg_root_x1_pem, .cert_len = sizeof(s_isrg_root_x1_pem), }; @@ -533,6 +534,7 @@ static void ota_download_task(void *arg) } } + int chunk_counter = 0; while (1) { if (s_cancel_requested) { ESP_LOGW(TAG, "OTA canceled by user"); @@ -555,7 +557,10 @@ static void ota_download_task(void *arg) if (read > 0) s_bytes_read = (size_t)read; if (total > 0) s_total_bytes = (size_t)total; - vTaskDelay(pdMS_TO_TICKS(10)); + /* Yield every 4 chunks (16 KB) to feed the task watchdog without throttling throughput */ + if (++chunk_counter % 4 == 0) { + vTaskDelay(1); + } } rfid_manager_pause(false);