@@ -107,7 +107,7 @@ void WiFiConnectionHandler::update() {
107107 lastConnectionTickTime = now;
108108
109109 switch (netConnectionState) {
110- case NetworkConnectionState::INIT: update_handleInit (networkStatus); break ;
110+ case NetworkConnectionState::INIT: netConnectionState = update_handleInit (networkStatus); break ;
111111 case NetworkConnectionState::CONNECTING: netConnectionState = update_handleConnecting (networkStatus); break ;
112112 case NetworkConnectionState::CONNECTED: netConnectionState = update_handleConnected (networkStatus); break ;
113113 case NetworkConnectionState::GETTIME: netConnectionState = update_handleGetTime (); break ;
@@ -201,17 +201,18 @@ void WiFiConnectionHandler::disconnect() {
201201 keepAlive = false ;
202202}
203203
204- void WiFiConnectionHandler::update_handleInit (int & networkStatus) {
204+ NetworkConnectionState WiFiConnectionHandler::update_handleInit (int & networkStatus) {
205205 Debug.print (DBG_VERBOSE, " ::INIT" );
206206
207207#ifndef BOARD_ESP8266
208208 networkStatus = WiFi.status ();
209209
210210 Debug.print (DBG_INFO, " WiFi.status(): %d" , networkStatus);
211211 if (networkStatus == NETWORK_HARDWARE_ERROR) {
212- // NO FURTHER ACTION WILL FOLLOW THIS
213- changeConnectionState (NetworkConnectionState::ERROR);
214- return ;
212+ execNetworkEventCallback (_on_error_event_callback, 0 );
213+ Debug.print (DBG_ERROR, " WiFi Hardware failure.\n Make sure you are using a WiFi enabled board/shield." );
214+ Debug.print (DBG_ERROR, " Then reset and retry." );
215+ return NetworkConnectionState::ERROR;
215216 }
216217
217218 Debug.print (DBG_ERROR, " Current WiFi Firmware: %s" , WiFi.firmwareVersion ());
@@ -228,7 +229,9 @@ void WiFiConnectionHandler::update_handleInit(int & networkStatus) {
228229 networkStatus = WiFi.begin (ssid, pass);
229230 delay (1000 );
230231#endif /* ifndef BOARD_ESP8266 */
231- changeConnectionState (NetworkConnectionState::CONNECTING);
232+
233+ connectionTickTimeInterval = CHECK_INTERVAL_CONNECTING;
234+ return NetworkConnectionState::CONNECTING;
232235}
233236
234237NetworkConnectionState WiFiConnectionHandler::update_handleConnecting (int & networkStatus) {
0 commit comments