File tree 1 file changed +9
-8
lines changed
libraries/ESP32/examples/Time/SimpleTime
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -33,14 +33,6 @@ void setup() {
33
33
// First step is to configure WiFi STA and connect in order to get the current time and date.
34
34
Serial.printf (" Connecting to %s " , ssid);
35
35
WiFi.begin (ssid, password);
36
- while (WiFi.status () != WL_CONNECTED) {
37
- delay (500 );
38
- Serial.print (" ." );
39
- }
40
- Serial.println (" CONNECTED" );
41
-
42
- // set notification call-back function
43
- sntp_set_time_sync_notification_cb (timeavailable);
44
36
45
37
/* *
46
38
* NTP server address could be acquired via DHCP,
@@ -52,6 +44,15 @@ void setup() {
52
44
*/
53
45
esp_sntp_servermode_dhcp (1 ); // (optional)
54
46
47
+ while (WiFi.status () != WL_CONNECTED) {
48
+ delay (500 );
49
+ Serial.print (" ." );
50
+ }
51
+ Serial.println (" CONNECTED" );
52
+
53
+ // set notification call-back function
54
+ sntp_set_time_sync_notification_cb (timeavailable);
55
+
55
56
/* *
56
57
* This will set configured ntp servers and constant TimeZone/daylightOffset
57
58
* should be OK if your time zone does not need to adjust daylightOffset twice a year,
You can’t perform that action at this time.
0 commit comments