-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Calling configTime without WiFi breaks. #2632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
How do you expect to access the internet without a connection? |
@stickbreaker If the connection is not there configureTime should not break right |
The driver needs to at least be initialized to get the needed structures. |
@a-c-sreedhar-reddy same issue here. This code works with ESP8266 but not with ESP32. Calling configTime once the WiFi connection is established works sometimes but not always apparently. It seems that the behavior is not as expected and configTime shouldn't fail that way too. |
Same here as well. If you explicitly set WiFi.mode(WIFI_STA); right before calling configureTime() it works for me. As far as i can see an actual wifi-connection is not required (as long as you don't whant to get the time from a NTP-Server at this stage), but for what ever reason the wifi module must be at least active. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Same issue here, attempting to use NTPClient.h before configuring the WiFi causes the ESP32 to reboot. |
@ThaChoppa 's comment is the solution. You must initialize the driver before calling any socket functions. |
Yes but can something be done so that esp does not reboot? |
@lbernstone It's a workaround but not a solution, especially when @gitdevus have mentioned the problem is not present on ESP8266. |
the only difference between the esp32 and esp8266 configTime methods is you can pass a null for the time servers and it will not enable SNTP. So the usecase from the OP is not entirely valid without an internet connection as it specifies a timeserver which should be polled for time data. esp32: https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-time.c#L51-L54 |
From the above links, it would appear that possibly just no-op the calls when the servers are null and that should fix this issue. |
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. |
Fixed in #3470 |
Hardware:
Board: ESP32 Dev Module
IDE name: Arduino IDE
Flash Frequency: 40Mhz
Upload Speed: 115200
Computer OS: Ubuntu
Description:
When configTime is called without WiFi the code breaks.
Sketch: (leave the backquotes for code formatting)
Debug Messages:
ESP exception decoder
The text was updated successfully, but these errors were encountered: