mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-19 07:55:54 +00:00
fix(esp_netif): Prevent running esp_netif_sntp_init() multiple times
Closes https://github.com/espressif/esp-idf/issues/12854
This commit is contained in:

committed by
David Čermák

parent
2f87894e58
commit
cea1893729
@@ -253,8 +253,8 @@ You can find a brief introduction to SNTP in general, its initialization code an
|
||||
This section provides more details about specific use cases of SNTP service, with statically configured servers, or using DHCP provided servers, or both.
|
||||
The workflow is usually very simple:
|
||||
|
||||
1) Initialize and configure the service using :cpp:func:`esp_netif_sntp_init()`.
|
||||
2) Start the service via :cpp:func:`esp_netif_sntp_start()`. This step is not needed if we auto-started the service in the previous step (default). It's useful to start the service explicitly after connecting, if we want to use DHCP obtained NTP servers. (This option needs to be enabled before connecting, but SNTP service should be started after)
|
||||
1) Initialize and configure the service using :cpp:func:`esp_netif_sntp_init()`. This operations can only be called once (unless the SNTP service has been destroyed by :cpp:func:`esp_netif_sntp_deinit()`)
|
||||
2) Start the service via :cpp:func:`esp_netif_sntp_start()`. This step is not needed if we auto-started the service in the previous step (default). It is useful to start the service explicitly after connecting if we want to use the DHCP-obtained NTP servers. Please note, this option needs to be enabled before connecting, but the SNTP service should be started after.
|
||||
3) Wait for the system time to synchronize using :cpp:func:`esp_netif_sntp_sync_wait()` (only if needed).
|
||||
4) Stop and destroy the service using :cpp:func:`esp_netif_sntp_deinit()`.
|
||||
|
||||
|
Reference in New Issue
Block a user