diff --git a/src/Network.cpp b/src/Network.cpp index c93e7df..3ea8fc7 100644 --- a/src/Network.cpp +++ b/src/Network.cpp @@ -275,7 +275,7 @@ void Network::processRequest(char *body, char *formData){ homeSpan.statusLED.start(LED_WIFI_CONNECTING); - responseBody+="" + responseBody+="" "

Initiating WiFi connection to:

" + String(wifiData.ssid) + "

"; WiFi.begin(wifiData.ssid,wifiData.pwd); @@ -308,10 +308,13 @@ void Network::processRequest(char *body, char *formData){ LOG1("In Get WiFi Status...\n"); if(WiFi.status()!=WL_CONNECTED){ - responseHead+="Refresh: 5\r\n"; - - responseBody+="

Re-trying connection to:

" + String(wifiData.ssid) + "

"; - responseBody+="

Timeout in " + String((alarmTimeOut-millis())/1000) + " seconds.

"; + waitTime+=2; + if(waitTime==12) + waitTime=2; + responseHead+="Refresh: " + String(waitTime) + "\r\n"; + responseBody+="

Re-initiating connection to:

" + String(wifiData.ssid) + "

"; + responseBody+="

(waiting " + String(waitTime) + " seconds to check for response)

"; + responseBody+="

Access Point termination in " + String((alarmTimeOut-millis())/1000) + " seconds.

"; responseBody+="
"; WiFi.begin(wifiData.ssid,wifiData.pwd); @@ -338,6 +341,7 @@ void Network::processRequest(char *body, char *formData){ LOG1("In Landing Page...\n"); homeSpan.statusLED.start(LED_AP_CONNECTED); + waitTime=2; responseBody+="

Welcome to HomeSpan! This page allows you to configure the above HomeSpan device to connect to your WiFi network.

" "

The LED on this device should be double-blinking during this configuration.

" diff --git a/src/Network.h b/src/Network.h index 44107f7..8a1226e 100644 --- a/src/Network.h +++ b/src/Network.h @@ -50,6 +50,7 @@ struct Network { int numSSID; WiFiClient client; // client used for HTTP calls + int waitTime; // time to wait between HTTP refreshed when checking for WiFi connection unsigned long alarmTimeOut; // alarm time after which access point is shut down and HomeSpan is re-started int apStatus; // tracks access point status (0=timed-out, -1=cancel, 1=save)