From 5ce72115395a61acb778568a051763052897e562 Mon Sep 17 00:00:00 2001 From: Gregg Date: Sat, 28 Oct 2023 18:40:04 -0500 Subject: [PATCH] Made conforming changes to setVerboseWiFiReconnect --- src/HomeSpan.cpp | 3 ++- src/HomeSpan.h | 4 ++-- src/src.ino | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp index f8994a7..213e877 100644 --- a/src/HomeSpan.cpp +++ b/src/HomeSpan.cpp @@ -408,7 +408,8 @@ void Span::checkConnect(){ LOG0("\n*** Can't connect to %s. You may type 'W ' to re-configure WiFi, or 'X ' to erase WiFi credentials. Will try connecting again in 60 seconds.\n\n",network.wifiData.ssid); waitTime=60000; } else { - if (verboseWiFiReconnect) 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); } diff --git a/src/HomeSpan.h b/src/HomeSpan.h index 7d98776..8cfc758 100644 --- a/src/HomeSpan.h +++ b/src/HomeSpan.h @@ -246,7 +246,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 + 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 @@ -353,7 +353,7 @@ class Span{ Span& setWebLogCSS(const char *css){webLog.css="\n" + String(css) + "\n";return(*this);} Span& setWebLogCallback(void (*f)(String &)){weblogCallback=f;return(*this);} - void setVerboseWiFiReconnect(bool verbose) { verboseWiFiReconnect = verbose;} + 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); diff --git a/src/src.ino b/src/src.ino index f21667b..59d60b3 100644 --- a/src/src.ino +++ b/src/src.ino @@ -74,7 +74,8 @@ void setup() { // homeSpan.enableOTA(); homeSpan.setWifiCallback(wifiCB); - homeSpan.setWifiCallbackAll(wifiCB_ALL); + homeSpan.setWifiCallbackAll(wifiCB_ALL).setVerboseWifiReconnect(false); + new SpanUserCommand('D', " - disconnect WiFi", [](const char *buf){WiFi.disconnect();});