17
17
//#include "tcpip_adapter.h"
18
18
#include "esp_netif.h"
19
19
20
+ #ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
21
+ #include "lwip/priv/tcpip_priv.h"
22
+ #endif
23
+
20
24
static void setTimeZone (long offset , int daylight ) {
21
25
char cst [17 ] = {0 };
22
26
char cdt [17 ] = "DST" ;
@@ -50,11 +54,25 @@ void configTime(long gmtOffset_sec, int daylightOffset_sec, const char *server1,
50
54
if (sntp_enabled ()) {
51
55
sntp_stop ();
52
56
}
57
+
58
+ #ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
59
+ if (!sys_thread_tcpip (LWIP_CORE_LOCK_QUERY_HOLDER )) {
60
+ LOCK_TCPIP_CORE ();
61
+ }
62
+ #endif
63
+
53
64
sntp_setoperatingmode (SNTP_OPMODE_POLL );
54
65
sntp_setservername (0 , (char * )server1 );
55
66
sntp_setservername (1 , (char * )server2 );
56
67
sntp_setservername (2 , (char * )server3 );
57
68
sntp_init ();
69
+
70
+ #ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
71
+ if (sys_thread_tcpip (LWIP_CORE_LOCK_QUERY_HOLDER )) {
72
+ UNLOCK_TCPIP_CORE ();
73
+ }
74
+ #endif
75
+
58
76
setTimeZone (- gmtOffset_sec , daylightOffset_sec );
59
77
}
60
78
@@ -68,11 +86,25 @@ void configTzTime(const char *tz, const char *server1, const char *server2, cons
68
86
if (sntp_enabled ()) {
69
87
sntp_stop ();
70
88
}
89
+
90
+ #ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
91
+ if (!sys_thread_tcpip (LWIP_CORE_LOCK_QUERY_HOLDER )) {
92
+ LOCK_TCPIP_CORE ();
93
+ }
94
+ #endif
95
+
71
96
sntp_setoperatingmode (SNTP_OPMODE_POLL );
72
97
sntp_setservername (0 , (char * )server1 );
73
98
sntp_setservername (1 , (char * )server2 );
74
99
sntp_setservername (2 , (char * )server3 );
75
100
sntp_init ();
101
+
102
+ #ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
103
+ if (sys_thread_tcpip (LWIP_CORE_LOCK_QUERY_HOLDER )) {
104
+ UNLOCK_TCPIP_CORE ();
105
+ }
106
+ #endif
107
+
76
108
setenv ("TZ" , tz , 1 );
77
109
tzset ();
78
110
}
0 commit comments