-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Feature request: To allow runtime config SNTP sync interval (IDFGH-2298) #4437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@AxelLin Thanks for reporting. |
Hi @AxelLin! |
Hi @KonstantinKondrashov , I (29) boot: ESP-IDF v4.1-dev-1961-g73384c1-dirty 2nd stage bootloader I (2436) wifi: AP's beacon interval = 102400 us, DTIM period = 3 As you can see, it failed to sync for 25 seconds (in the code sntp_set_sync_interval(15000);) |
Hi @Eugene-Ilyushchyts ! |
@KonstantinKondrashov while (sntp_get_sync_status() == SNTP_SYNC_STATUS_RESET && ++retry < retry_count) Now this workaround doesn't work. Thank you in advance. |
I have checked this example right now with your v4.1-dev-1961-g73384c1 version and I did not observe any issue, it updates time while the first 2-3 seconds. Your workaround looks strange. Each a second you call initialize_sntp(). It means you give the SNTP server only 1 sec. Please change the timeout at least to vTaskDelay(2 or 3 sec) . while (sntp_get_sync_status() == SNTP_SYNC_STATUS_RESET && ++retry < retry_count)
{
ESP_LOGI(TAG, "Waiting for system time to be set... (%d/%d)", retry, retry_count);
vTaskDelay(1000 / portTICK_PERIOD_MS);
if (retry % 3 == 0) {
sntp_restart(); // Instead of initialize_sntp() you can use this function - sntp_restart().
}
} |
@KonstantinKondrashov |
@Eugene-Ilyushchyts I will try to reproduce your issue from my side. |
@KonstantinKondrashov |
In current ESP-IDF, the SNTP sync interval is determinate by CONFIG_LWIP_SNTP_UPDATE_DELAY at compile time.
The compile time determinate setting cannot meet various use cases.
Suggest to provide API for setting SNTP sync interval at run-time so this setting can be user configurable.
The text was updated successfully, but these errors were encountered: