Added option to set Priority and CPU in autoPoll()

Also added vTaskDelay(5) in pollTask to make sure competing tasks can operate (for example, if priority was set to greater than 2, touch sensor did not operate).  Adding vTaskDelay(5) solved this problem.
This commit is contained in:
Gregg 2023-03-25 10:58:03 -05:00
parent 61665c6776
commit ecd97e6e71
2 changed files with 6 additions and 1 deletions

View File

@ -309,6 +309,8 @@ void Span::pollTask() {
}
statusLED->check();
vTaskDelay(5);
} // poll

View File

@ -341,7 +341,10 @@ class Span{
va_end(ap);
}
void autoPoll(uint32_t stackSize=CONFIG_ARDUINO_LOOP_STACK_SIZE){xTaskCreateUniversal([](void *parms){for(;;)homeSpan.pollTask();}, "pollTask", stackSize, NULL, 1, &pollTaskHandle, 0);} // start pollTask()
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);
Serial.printf("\n*** AutoPolling Task started with priority=%d\n\n",uxTaskPriorityGet(pollTaskHandle));
}
void setTimeServerTimeout(uint32_t tSec){webLog.waitTime=tSec*1000;} // sets wait time (in seconds) for optional web log time server to connect