Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
a9929670
Unverified
Commit
a9929670
authored
Jun 19, 2024
by
Me No Dev
Committed by
GitHub
Jun 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(time): Fix SimpleTime to also use DHCP (#9886)
parent
96c2c71c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
libraries/ESP32/examples/Time/SimpleTime/SimpleTime.ino
libraries/ESP32/examples/Time/SimpleTime/SimpleTime.ino
+9
-8
No files found.
libraries/ESP32/examples/Time/SimpleTime/SimpleTime.ino
View file @
a9929670
...
...
@@ -33,14 +33,6 @@ void setup() {
// First step is to configure WiFi STA and connect in order to get the current time and date.
Serial
.
printf
(
"Connecting to %s "
,
ssid
);
WiFi
.
begin
(
ssid
,
password
);
while
(
WiFi
.
status
()
!=
WL_CONNECTED
)
{
delay
(
500
);
Serial
.
print
(
"."
);
}
Serial
.
println
(
" CONNECTED"
);
// set notification call-back function
sntp_set_time_sync_notification_cb
(
timeavailable
);
/**
* NTP server address could be acquired via DHCP,
...
...
@@ -52,6 +44,15 @@ void setup() {
*/
esp_sntp_servermode_dhcp
(
1
);
// (optional)
while
(
WiFi
.
status
()
!=
WL_CONNECTED
)
{
delay
(
500
);
Serial
.
print
(
"."
);
}
Serial
.
println
(
" CONNECTED"
);
// set notification call-back function
sntp_set_time_sync_notification_cb
(
timeavailable
);
/**
* This will set configured ntp servers and constant TimeZone/daylightOffset
* should be OK if your time zone does not need to adjust daylightOffset twice a year,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment