@@ -108,7 +108,7 @@ void WiFiConnectionHandler::update() {
108
108
109
109
switch (netConnectionState) {
110
110
case NetworkConnectionState::INIT: update_handleInit (networkStatus); break ;
111
- case NetworkConnectionState::CONNECTING: update_handleConnecting (networkStatus); break ;
111
+ case NetworkConnectionState::CONNECTING: netConnectionState = update_handleConnecting (networkStatus); break ;
112
112
case NetworkConnectionState::CONNECTED: update_handleConnected (networkStatus); break ;
113
113
case NetworkConnectionState::GETTIME: netConnectionState = update_handleGetTime (); break ;
114
114
case NetworkConnectionState::DISCONNECTING: update_handleDisconnecting (networkStatus); break ;
@@ -231,13 +231,12 @@ void WiFiConnectionHandler::update_handleInit(int & networkStatus) {
231
231
changeConnectionState (NetworkConnectionState::CONNECTING);
232
232
}
233
233
234
- void WiFiConnectionHandler::update_handleConnecting (int & networkStatus) {
234
+ NetworkConnectionState WiFiConnectionHandler::update_handleConnecting (int & networkStatus) {
235
235
Debug.print (DBG_VERBOSE, " ::CONNECTING" );
236
236
237
237
networkStatus = WiFi.status ();
238
238
239
239
#ifndef BOARD_ESP8266
240
-
241
240
if (networkStatus != WL_CONNECTED) {
242
241
networkStatus = WiFi.begin (ssid, pass);
243
242
}
@@ -249,14 +248,13 @@ void WiFiConnectionHandler::update_handleConnecting(int & networkStatus) {
249
248
if (networkStatus != NETWORK_CONNECTED) {
250
249
Debug.print (DBG_ERROR, " Connection to \" %s\" failed" , ssid);
251
250
Debug.print (DBG_INFO, " Retrying in \" %d\" milliseconds" , connectionTickTimeInterval);
252
- return ;
251
+ return NetworkConnectionState::CONNECTING ;
253
252
}
254
253
else {
255
254
Debug.print (DBG_INFO, " Connected to \" %s\" " , ssid);
256
255
execNetworkEventCallback (_on_connect_event_callback, 0 );
257
256
connectionTickTimeInterval = CHECK_INTERVAL_CONNECTED;
258
- changeConnectionState (NetworkConnectionState::GETTIME);
259
- return ;
257
+ return NetworkConnectionState::GETTIME;
260
258
}
261
259
}
262
260
0 commit comments