vTaskDelay in pollTask configurable

This commit is contained in:
Michael Geramb 2023-10-21 18:34:55 +02:00
parent 831d3640cc
commit a4eb12bc77
2 changed files with 7 additions and 7 deletions

View File

@ -153,7 +153,7 @@ void Span::begin(Category catID, const char *displayName, const char *hostNameBa
///////////////////////////////
void Span::poll() {
void Span::poll(int taskDelay) {
if(pollTaskHandle){
LOG0("\n** FATAL ERROR: Do not call homeSpan.poll() directly if homeSpan.start() is used!\n** PROGRAM HALTED **\n\n");
@ -161,12 +161,12 @@ void Span::poll() {
while(1);
}
pollTask();
pollTask(taskDelay);
}
///////////////////////////////
void Span::pollTask() {
void Span::pollTask(int taskDelay) {
if(!strlen(category)){
LOG0("\n** FATAL ERROR: Cannot start homeSpan polling without an initial call to homeSpan.begin()!\n** PROGRAM HALTED **\n\n");
@ -300,8 +300,8 @@ void Span::pollTask() {
}
statusLED->check();
vTaskDelay(5);
if (taskDelay > 0)
vTaskDelay(taskDelay);
} // poll

View File

@ -254,7 +254,7 @@ class Span{
unordered_map<char, SpanUserCommand *> UserCommands; // map of pointers to all UserCommands
void pollTask(); // poll HAP Clients and process any new HAP requests
void pollTask(int taskDelay = 5); // poll HAP Clients and process any new HAP requests with configurable vTaskDelay
int getFreeSlot(); // returns free HAPClient slot number. HAPClients slot keep track of each active HAPClient connection
void checkConnect(); // check WiFi connection; connect if needed
void commandMode(); // allows user to control and reset HomeSpan settings with the control button
@ -285,7 +285,7 @@ class Span{
const char *hostNameBase=DEFAULT_HOST_NAME,
const char *modelName=DEFAULT_MODEL_NAME);
void poll(); // calls pollTask() with some error checking
void poll(int taskDelay = 5); // calls pollTask() with some error checking and configurable vTaskDelay
void processSerialCommand(const char *c); // process command 'c' (typically from readSerial, though can be called with any 'c')
boolean updateDatabase(boolean updateMDNS=true); // updates HAP Configuration Number and Loop vector; if updateMDNS=true and config number has changed, re-broadcasts MDNS 'c#' record; returns true if config number changed