sntp/lwip: Add SNTP_UPDATE_DELAY option in Kconfig

Closes: https://github.com/espressif/esp-idf/issues/2277
Closes: IDFGH-337
This commit is contained in:
Konstantin Kondrashov 2019-06-17 15:44:25 +08:00 committed by bot
parent 07a3eca372
commit c50d44e66e
2 changed files with 32 additions and 9 deletions

View file

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

View file

@ -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 }; \