Skip to content

Commit 8172a1d

Browse files
committed
Move retrieval of time for ESP8266 out of update_handleGetTime since this is really the only type of board which needs this state
1 parent e7ae47c commit 8172a1d

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/Arduino_WiFiConnectionHandler.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ NetworkConnectionState WiFiConnectionHandler::check()
7979
case NetworkConnectionState::INIT: _netConnectionState = update_handleInit (); break;
8080
case NetworkConnectionState::CONNECTING: _netConnectionState = update_handleConnecting (); break;
8181
case NetworkConnectionState::CONNECTED: _netConnectionState = update_handleConnected (); break;
82-
case NetworkConnectionState::GETTIME: _netConnectionState = update_handleGetTime (); break;
82+
case NetworkConnectionState::GETTIME: /* Unused */ break;
8383
case NetworkConnectionState::DISCONNECTING: _netConnectionState = update_handleDisconnecting(); break;
8484
case NetworkConnectionState::DISCONNECTED: _netConnectionState = update_handleDisconnected (); break;
8585
case NetworkConnectionState::ERROR: break;
@@ -144,7 +144,10 @@ NetworkConnectionState WiFiConnectionHandler::update_handleConnecting()
144144
{
145145
Debug.print(DBG_INFO, "Connected to \"%s\"", _ssid);
146146
execCallback(NetworkConnectionEvent::CONNECTED);
147-
return NetworkConnectionState::GETTIME;
147+
#ifdef BOARD_ESP8266
148+
configTime(0, 0, "time.arduino.cc", "pool.ntp.org", "time.nist.gov");
149+
#endif
150+
return NetworkConnectionState::CONNECTED;
148151
}
149152
}
150153

@@ -167,14 +170,6 @@ NetworkConnectionState WiFiConnectionHandler::update_handleConnected()
167170
return NetworkConnectionState::CONNECTED;
168171
}
169172

170-
NetworkConnectionState WiFiConnectionHandler::update_handleGetTime()
171-
{
172-
#ifdef BOARD_ESP8266
173-
configTime(0, 0, "time.arduino.cc", "pool.ntp.org", "time.nist.gov");
174-
#endif
175-
return NetworkConnectionState::CONNECTED;
176-
}
177-
178173
NetworkConnectionState WiFiConnectionHandler::update_handleDisconnecting()
179174
{
180175
WiFi.disconnect();

src/Arduino_WiFiConnectionHandler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class WiFiConnectionHandler : public ConnectionHandler
5555
NetworkConnectionState update_handleInit ();
5656
NetworkConnectionState update_handleConnecting ();
5757
NetworkConnectionState update_handleConnected ();
58-
NetworkConnectionState update_handleGetTime ();
5958
NetworkConnectionState update_handleDisconnecting();
6059
NetworkConnectionState update_handleDisconnected ();
6160
};

0 commit comments

Comments
 (0)