added more SNTP servers for reservation
This commit is contained in:
parent
5f8f2be7b0
commit
a856034f1d
18
Kconfig
18
Kconfig
|
|
@ -84,11 +84,23 @@ menu "WebGUIApp"
|
|||
bool "Enabled SNTP time update"
|
||||
default y
|
||||
|
||||
config WEBGUIAPP_SNTP_HOST
|
||||
string "URL of SNTP server"
|
||||
config WEBGUIAPP_SNTP_HOST_1
|
||||
string "URL of SNTP server 1"
|
||||
default "1.pool.ntp.org"
|
||||
help
|
||||
URL of SNTP server
|
||||
|
||||
config WEBGUIAPP_SNTP_HOST_2
|
||||
string "URL of SNTP server 2"
|
||||
default "2.pool.ntp.org"
|
||||
help
|
||||
URL of firmware file for OTA update
|
||||
URL of SNTP server
|
||||
|
||||
config WEBGUIAPP_SNTP_HOST_3
|
||||
string "URL of SNTP server 3"
|
||||
default "3.pool.ntp.org"
|
||||
help
|
||||
URL of SNTP server
|
||||
|
||||
config WEBGUIAPP_SNTP_AUTOUPDATE_PERIOD
|
||||
int "SNTP autoupdate period in seconds"
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@
|
|||
{
|
||||
int TimeZone;
|
||||
char SntpServerAdr[33];
|
||||
char SntpServer2Adr[33];
|
||||
char SntpServer3Adr[33];
|
||||
struct
|
||||
{
|
||||
char b1 :1;
|
||||
|
|
|
|||
|
|
@ -397,6 +397,10 @@ static HTTP_IO_RESULT HTTPPostServicesSettings(httpd_req_t *req, char *PostData)
|
|||
}
|
||||
httpd_query_key_value(PostData, "tsr", GetSysConf()->sntpClient.SntpServerAdr,
|
||||
sizeof(GetSysConf()->sntpClient.SntpServerAdr));
|
||||
httpd_query_key_value(PostData, "tsr2", GetSysConf()->sntpClient.SntpServer2Adr,
|
||||
sizeof(GetSysConf()->sntpClient.SntpServer2Adr));
|
||||
httpd_query_key_value(PostData, "tsr3", GetSysConf()->sntpClient.SntpServer3Adr,
|
||||
sizeof(GetSysConf()->sntpClient.SntpServer3Adr));
|
||||
|
||||
/*MQTT Test button handlers*/
|
||||
if (httpd_query_key_value(PostData, "mqtttest1", tmp, 6) == ESP_OK)
|
||||
|
|
|
|||
|
|
@ -617,6 +617,14 @@ void HTTPPrint_tmsrv(char *VarData, void *arg)
|
|||
{
|
||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", GetSysConf()->sntpClient.SntpServerAdr);
|
||||
}
|
||||
void HTTPPrint_tmsrv2(char *VarData, void *arg)
|
||||
{
|
||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", GetSysConf()->sntpClient.SntpServer2Adr);
|
||||
}
|
||||
void HTTPPrint_tmsrv3(char *VarData, void *arg)
|
||||
{
|
||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", GetSysConf()->sntpClient.SntpServer3Adr);
|
||||
}
|
||||
|
||||
static void HTTPPrint_freeram(char *VarData, void *arg)
|
||||
{
|
||||
|
|
@ -821,6 +829,8 @@ dyn_var_handler_t HANDLERS_ARRAY[] = {
|
|||
/*SNTP*/
|
||||
{ "sntpen", sizeof("sntpen") - 1, &HTTPPrint_sntpen },
|
||||
{ "tmsrv", sizeof("tmsrv") - 1, &HTTPPrint_tmsrv },
|
||||
{ "tmsrv2", sizeof("tmsrv2") - 1, &HTTPPrint_tmsrv2 },
|
||||
{ "tmsrv3", sizeof("tmsrv3") - 1, &HTTPPrint_tmsrv3 },
|
||||
|
||||
{ "freeram", sizeof("freeram") - 1, &HTTPPrint_freeram },
|
||||
{ "minram", sizeof("minram") - 1, &HTTPPrint_minram },
|
||||
|
|
|
|||
|
|
@ -68,7 +68,9 @@ static void time_sync_notification_cb(struct timeval *tv)
|
|||
static void initialize_sntp(void)
|
||||
{
|
||||
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
||||
sntp_setservername(0, "pool.ntp.org");
|
||||
sntp_setservername(0, GetSysConf()->sntpClient.SntpServerAdr);
|
||||
sntp_setservername(1, GetSysConf()->sntpClient.SntpServerAdr);
|
||||
sntp_setservername(2, GetSysConf()->sntpClient.SntpServerAdr);
|
||||
sntp_set_sync_interval(6*3600*1000);
|
||||
sntp_set_time_sync_notification_cb(time_sync_notification_cb);
|
||||
sntp_init();
|
||||
|
|
|
|||
|
|
@ -353,8 +353,12 @@ esp_netif_str_to_ip4(CONFIG_WEBGUIAPP_DNS3_ADDRESS_DEFAULT, (esp_ip4_addr_t*) &C
|
|||
memcpy(Conf->mqttStation[1].UserPass, CONFIG_WEBGUIAPP_MQTT_PASSWORD, sizeof(CONFIG_WEBGUIAPP_MQTT_PASSWORD));
|
||||
#endif
|
||||
#endif
|
||||
memcpy(Conf->sntpClient.SntpServerAdr, CONFIG_WEBGUIAPP_SNTP_HOST,
|
||||
sizeof(CONFIG_WEBGUIAPP_SNTP_HOST));
|
||||
memcpy(Conf->sntpClient.SntpServerAdr, CONFIG_WEBGUIAPP_SNTP_HOST_1,
|
||||
sizeof(CONFIG_WEBGUIAPP_SNTP_HOST_1));
|
||||
memcpy(Conf->sntpClient.SntpServer2Adr, CONFIG_WEBGUIAPP_SNTP_HOST_2,
|
||||
sizeof(CONFIG_WEBGUIAPP_SNTP_HOST_2));
|
||||
memcpy(Conf->sntpClient.SntpServer3Adr, CONFIG_WEBGUIAPP_SNTP_HOST_3,
|
||||
sizeof(CONFIG_WEBGUIAPP_SNTP_HOST_3));
|
||||
Conf->sntpClient.Flags1.bIsGlobalEnabled = CONFIG_WEBGUIAPP_SNTP_AUTOUPDATE_ENABLE;
|
||||
Conf->sntpClient.TimeZone = CONFIG_WEBGUIAPP_SNTP_TIMEZONE;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user