fix(sntp): Lock / Unlock LWIP if CONFIG_LWIP_TCPIP_CORE_LOCKING is set
- Fixes: #10526 - Completes old PR #10529
This commit is contained in:
parent
fb6e977aa8
commit
71396de822
1 changed files with 8 additions and 6 deletions
|
|
@ -51,9 +51,6 @@ static void setTimeZone(long offset, int daylight) {
|
|||
void configTime(long gmtOffset_sec, int daylightOffset_sec, const char *server1, const char *server2, const char *server3) {
|
||||
//tcpip_adapter_init(); // Should not hurt anything if already inited
|
||||
esp_netif_init();
|
||||
if (sntp_enabled()) {
|
||||
sntp_stop();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
|
||||
if (!sys_thread_tcpip(LWIP_CORE_LOCK_QUERY_HOLDER)) {
|
||||
|
|
@ -61,6 +58,10 @@ void configTime(long gmtOffset_sec, int daylightOffset_sec, const char *server1,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (sntp_enabled()) {
|
||||
sntp_stop();
|
||||
}
|
||||
|
||||
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
||||
sntp_setservername(0, (char *)server1);
|
||||
sntp_setservername(1, (char *)server2);
|
||||
|
|
@ -83,9 +84,6 @@ void configTime(long gmtOffset_sec, int daylightOffset_sec, const char *server1,
|
|||
void configTzTime(const char *tz, const char *server1, const char *server2, const char *server3) {
|
||||
//tcpip_adapter_init(); // Should not hurt anything if already inited
|
||||
esp_netif_init();
|
||||
if (sntp_enabled()) {
|
||||
sntp_stop();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
|
||||
if (!sys_thread_tcpip(LWIP_CORE_LOCK_QUERY_HOLDER)) {
|
||||
|
|
@ -93,6 +91,10 @@ void configTzTime(const char *tz, const char *server1, const char *server2, cons
|
|||
}
|
||||
#endif
|
||||
|
||||
if (sntp_enabled()) {
|
||||
sntp_stop();
|
||||
}
|
||||
|
||||
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
||||
sntp_setservername(0, (char *)server1);
|
||||
sntp_setservername(1, (char *)server2);
|
||||
|
|
|
|||
Loading…
Reference in a new issue