From c50d44e66e6f2e363a08dc9e197e7a1389213b24 Mon Sep 17 00:00:00 2001 From: Konstantin Kondrashov Date: Mon, 17 Jun 2019 15:44:25 +0800 Subject: [PATCH] sntp/lwip: Add SNTP_UPDATE_DELAY option in Kconfig Closes: https://github.com/espressif/esp-idf/issues/2277 Closes: IDFGH-337 --- components/lwip/Kconfig | 31 +++++++++++++------ components/lwip/port/esp32/include/lwipopts.h | 10 ++++++ 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 025305d95..34557400a 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -74,15 +74,6 @@ menu "LWIP" help Enabling this option allows checking for available data on a netconn. - config LWIP_DHCP_MAX_NTP_SERVERS - int "Maximum number of NTP servers" - default 1 - range 1 16 - help - Set maximum number of NTP servers used by LwIP SNTP module. - First argument of sntp_setserver/sntp_setservername functions - is limited to this value. - config LWIP_IP_FRAG bool "Enable fragment outgoing IP packets" default n @@ -560,4 +551,26 @@ menu "LWIP" endmenu # LWIP RAW API + menu "SNTP" + + config LWIP_DHCP_MAX_NTP_SERVERS + int "Maximum number of NTP servers" + default 1 + range 1 16 + help + Set maximum number of NTP servers used by LwIP SNTP module. + First argument of sntp_setserver/sntp_setservername functions + is limited to this value. + + config LWIP_SNTP_UPDATE_DELAY + int "Request interval to update time (ms)" + range 15000 4294967295 + default 3600000 + help + This option allows you to set the time update period via SNTP. + Default is 1 hour. Must not be below 15 seconds by specification. + (SNTPv4 RFC 4330 enforces a minimum update time of 15 seconds). + + endmenu # SNTP + endmenu diff --git a/components/lwip/port/esp32/include/lwipopts.h b/components/lwip/port/esp32/include/lwipopts.h index c22046e0d..de0ee9c31 100644 --- a/components/lwip/port/esp32/include/lwipopts.h +++ b/components/lwip/port/esp32/include/lwipopts.h @@ -833,6 +833,16 @@ enum { #define LWIP_DHCP_MAX_NTP_SERVERS CONFIG_LWIP_DHCP_MAX_NTP_SERVERS #define LWIP_TIMEVAL_PRIVATE 0 +/* + -------------------------------------- + ------------ SNTP options ------------ + -------------------------------------- +*/ +/* + * SNTP update delay - in milliseconds + */ +#define SNTP_UPDATE_DELAY CONFIG_LWIP_SNTP_UPDATE_DELAY + #define SNTP_SET_SYSTEM_TIME_US(sec, us) \ do { \ struct timeval tv = { .tv_sec = sec, .tv_usec = us }; \