Skip to content

Commit f41beb9

Browse files
lbernstoneme-no-dev
authored andcommitted
Fixed so configTime will not crash if tcpip is not initialized (#3470)
1 parent 8c4ca5a commit f41beb9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: cores/esp32/esp32-hal-time.c

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "esp32-hal.h"
1616
#include "lwip/apps/sntp.h"
17+
#include "tcpip_adapter.h"
1718

1819
static void setTimeZone(long offset, int daylight)
1920
{
@@ -45,6 +46,7 @@ static void setTimeZone(long offset, int daylight)
4546
* */
4647
void configTime(long gmtOffset_sec, int daylightOffset_sec, const char* server1, const char* server2, const char* server3)
4748
{
49+
tcpip_adapter_init(); // Should not hurt anything if already inited
4850
if(sntp_enabled()){
4951
sntp_stop();
5052
}
@@ -62,6 +64,7 @@ void configTime(long gmtOffset_sec, int daylightOffset_sec, const char* server1,
6264
* */
6365
void configTzTime(const char* tz, const char* server1, const char* server2, const char* server3)
6466
{
67+
tcpip_adapter_init(); // Should not hurt anything if already inited
6568
if(sntp_enabled()){
6669
sntp_stop();
6770
}

0 commit comments

Comments
 (0)