From c300878841091d5e946c83339e4ee071b63fb85c Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 29 May 2024 17:58:08 +0200 Subject: [PATCH 1/2] OTA: increase blocking download window to 2s --- src/ota/interface/OTAInterfaceDefault.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ota/interface/OTAInterfaceDefault.h b/src/ota/interface/OTAInterfaceDefault.h index 9e09d3cf..95384817 100644 --- a/src/ota/interface/OTAInterfaceDefault.h +++ b/src/ota/interface/OTAInterfaceDefault.h @@ -51,7 +51,7 @@ class OTADefaultCloudProcessInterface: public OTACloudProcessInterface { // The amount of time that each iteration of Fetch has to take at least // This mitigate the issues arising from tasks run in main loop that are using all the computing time - static constexpr uint32_t downloadTime = 100; + static constexpr uint32_t downloadTime = 2000; enum OTADownloadState: uint8_t { OtaDownloadHeader, From b8d5305f22a6f9aac5b92428f464156941a7ef51 Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 29 May 2024 15:36:02 +0200 Subject: [PATCH 2/2] OTA: make fetch blocking for real and also wait for data --- src/ota/interface/OTAInterfaceDefault.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ota/interface/OTAInterfaceDefault.cpp b/src/ota/interface/OTAInterfaceDefault.cpp index 1b0a34fd..9e9891c8 100644 --- a/src/ota/interface/OTAInterfaceDefault.cpp +++ b/src/ota/interface/OTAInterfaceDefault.cpp @@ -94,7 +94,9 @@ OTACloudProcessInterface::State OTADefaultCloudProcessInterface::fetch() { do { if(http_client->available() == 0) { - goto exit; + /* Avoid tight loop and allow yield */ + delay(1); + continue; } http_res = http_client->read(context->buffer, context->buf_len);