From 8b3192e122f4c4ee62c831e84edc04b8ffe5b853 Mon Sep 17 00:00:00 2001 From: Gregg Date: Tue, 31 Oct 2023 18:11:09 -0500 Subject: [PATCH] Moved vTaskDelay(5) from pollTask() to homeSpan.autoPoll() Adding the vTaskDelay(5) to the code that spawns the separate task is more consistent with how Arduino-ESP32 spawns the main loop() task. --- src/HomeSpan.cpp | 3 --- src/HomeSpan.h | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp index 7bc7748..2cc2614 100644 --- a/src/HomeSpan.cpp +++ b/src/HomeSpan.cpp @@ -304,9 +304,6 @@ void Span::pollTask() { } statusLED->check(); - - if(pollTaskHandle) - vTaskDelay(5); } // poll diff --git a/src/HomeSpan.h b/src/HomeSpan.h index 8cfc758..7b2cf26 100644 --- a/src/HomeSpan.h +++ b/src/HomeSpan.h @@ -356,7 +356,7 @@ class Span{ Span& setVerboseWifiReconnect(bool verbose=true){verboseWifiReconnect=verbose;return(*this);} void autoPoll(uint32_t stackSize=8192, uint32_t priority=1, uint32_t cpu=0){ // start pollTask() - xTaskCreateUniversal([](void *parms){for(;;)homeSpan.pollTask();}, "pollTask", stackSize, NULL, priority, &pollTaskHandle, cpu); + xTaskCreateUniversal([](void *parms){for(;;)homeSpan.pollTask();vTaskDelay(5);}, "pollTask", stackSize, NULL, priority, &pollTaskHandle, cpu); LOG0("\n*** AutoPolling Task started with priority=%d\n\n",uxTaskPriorityGet(pollTaskHandle)); }