Merge pull request #10725 from mathieucarbou/issue-10526

fix(sntp): Lock / Unlock LWIP if CONFIG_LWIP_TCPIP_CORE_LOCKING is set
This commit is contained in:
Me No Dev 2024-12-13 15:31:47 +02:00 committed by GitHub
commit 740fc0b78e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);