From a67e776c9a37265b2ff1925dd76c9b10b841ea8a Mon Sep 17 00:00:00 2001 From: kel30a <1787606+kel30a@users.noreply.github.com> Date: Wed, 11 Sep 2024 00:05:33 +1000 Subject: [PATCH] Fix issues in URLStream when compiling in ESP IDF (#1693) * 1. Fix incorrect delay implementation causing UrlStream to take 50 seconds to start instead of 50ms 2. Add missing semi colon's 3. Remove duplicate micros declaration * Add missing initializer to get rid of compile warning * remove dodgy fix for warning. Don't have a good solution for now --- src/AudioHttp/HttpRequest.h | 2 +- src/AudioHttp/URLStream.h | 2 +- src/AudioTools/AudioRuntime.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/AudioHttp/HttpRequest.h b/src/AudioHttp/HttpRequest.h index 2e65472349..dbaf8e4f74 100644 --- a/src/AudioHttp/HttpRequest.h +++ b/src/AudioHttp/HttpRequest.h @@ -288,7 +288,7 @@ class HttpRequest { if (isChunked()) { write(nullptr, 0); } - LOGI("Request written ... waiting for reply") + LOGI("Request written ... waiting for reply"); // Commented out because this breaks the RP2040 W // client_ptr->flush(); reply_header.read(*client_ptr); diff --git a/src/AudioHttp/URLStream.h b/src/AudioHttp/URLStream.h index 85901351d5..01ea2d80e5 100644 --- a/src/AudioHttp/URLStream.h +++ b/src/AudioHttp/URLStream.h @@ -231,7 +231,7 @@ class URLStream : public AbstractURLStream { TRACED(); uint32_t end = millis() + timeout; if (request.available() == 0) { - LOGI("Request written ... waiting for reply") + LOGI("Request written ... waiting for reply"); while (request.available() == 0) { if (millis() > end) break; // stop waiting if we got an error diff --git a/src/AudioTools/AudioRuntime.h b/src/AudioTools/AudioRuntime.h index 20e1d1ae23..3904c3c69f 100644 --- a/src/AudioTools/AudioRuntime.h +++ b/src/AudioTools/AudioRuntime.h @@ -8,11 +8,11 @@ // delay and millis is needed by this framework #define DESKTOP_MILLIS_DEFINED -inline void delay(uint32_t ms){ vTaskDelay(ms * 1000 / portTICK_PERIOD_MS);} +inline void delay(uint32_t ms){ vTaskDelay(ms / portTICK_PERIOD_MS);} inline uint32_t millis() {return (xTaskGetTickCount() * portTICK_PERIOD_MS);} inline void delayMicroseconds(uint32_t ms) {esp_rom_delay_us(ms);} //inline uint64_t micros() { return xTaskGetTickCount();} -extern uint64_t micros(); +// extern uint64_t micros(); #endif