Verbose WiFi Reconnect

Add the ability to turn off WiFi reconnect messages.
This commit is contained in:
Francois 2023-10-27 08:17:06 -04:00
parent 831d3640cc
commit 2bda112780
2 changed files with 4 additions and 1 deletions

View File

@ -408,7 +408,7 @@ void Span::checkConnect(){
LOG0("\n*** Can't connect to %s. You may type 'W <return>' to re-configure WiFi, or 'X <return>' to erase WiFi credentials. Will try connecting again in 60 seconds.\n\n",network.wifiData.ssid);
waitTime=60000;
} else {
addWebLog(true,"Trying to connect to %s. Waiting %d sec...",network.wifiData.ssid,waitTime/1000);
if (verboseWiFiReconnect) addWebLog(true,"Trying to connect to %s. Waiting %d sec...",network.wifiData.ssid,waitTime/1000);
WiFi.begin(network.wifiData.ssid,network.wifiData.pwd);
}

View File

@ -243,6 +243,7 @@ class Span{
Network network; // configures WiFi and Setup Code via either serial monitor or temporary Access Point
SpanWebLog webLog; // optional web status/log
TaskHandle_t pollTaskHandle = NULL; // optional task handle to use for poll() function
boolean verboseWiFiReconnect = true; // Set to false to not print WiFi reconnect attempts messages
SpanOTA spanOTA; // manages OTA process
SpanConfig hapConfig; // track configuration changes to the HAP Accessory database; used to increment the configuration number (c#) when changes found
@ -345,6 +346,8 @@ class Span{
void setWebLogCSS(const char *css){webLog.css="\n" + String(css) + "\n";}
void setVerboseWiFiReconnect(bool verbose) { verboseWiFiReconnect = verbose;}
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);
LOG0("\n*** AutoPolling Task started with priority=%d\n\n",uxTaskPriorityGet(pollTaskHandle));