diff --git a/src/driver/drv_main.c b/src/driver/drv_main.c index 870f3a393..fe2fa78ab 100644 --- a/src/driver/drv_main.c +++ b/src/driver/drv_main.c @@ -107,7 +107,7 @@ static driver_t g_drivers[] = { #if ENABLE_NTP //drvdetail:{"name":"NTP", //drvdetail:"title":"TODO", - //drvdetail:"descr":"NTP driver is required to get current time and date from web. Without it, there is no correct datetime. Put 'startDriver NTP' in short startup line or autoexec.bat to run it on start.", + //drvdetail:"descr":"NTP driver is used to get current time and date from web. Without it, there is no correct datetime. You can add a value for a sync interval in seconds (defaults to 60 seconds). Put 'startDriver NTP' in short startup line or autoexec.bat to run it on start.", //drvdetail:"requires":""} { "NTP", NTP_Init, NTP_OnEverySecond, NTP_AppendInformationToHTTPIndexPage, NULL, NTP_Stop , NULL, false }, #endif diff --git a/src/driver/drv_ntp.c b/src/driver/drv_ntp.c index f1ad29cd4..88490c004 100644 --- a/src/driver/drv_ntp.c +++ b/src/driver/drv_ntp.c @@ -57,6 +57,7 @@ static struct sockaddr_in g_address; static int adrLen; // in seconds, before next retry static int g_ntp_delay = 0; +static int g_ntp_syncinterval=60; static bool g_synced; // time offset (time zone?) in seconds //#define CFG_DEFAULT_TIMEOFFSETSECONDS (-8 * 60 * 60) @@ -178,8 +179,8 @@ void NTP_Init() { //cmddetail:"fn":"NTP_Info","file":"driver/drv_ntp.c","requires":"", //cmddetail:"examples":""} CMD_RegisterCommand("ntp_info", NTP_Info, NULL); - - addLogAdv(LOG_INFO, LOG_FEATURE_NTP, "NTP driver initialized with server=%s, offset=%d", CFG_GetNTPServer(), g_timeOffsetSeconds); + g_ntp_syncinterval = Tokenizer_GetArgIntegerDefault(1, 60); + addLogAdv(LOG_INFO, LOG_FEATURE_NTP, "NTP driver initialized with server=%s, offset=%d, syncing every %i seconds", CFG_GetNTPServer(), g_timeOffsetSeconds,g_ntp_syncinterval); g_synced = false; } @@ -213,7 +214,7 @@ void NTP_Shutdown() { } g_ntp_socket = 0; // can attempt in next 10 seconds - g_ntp_delay = 60; + g_ntp_delay = g_ntp_syncinterval-1; } void NTP_SendRequest(bool bBlocking) { byte *ptr; diff --git a/src/httpserver/json_interface.c b/src/httpserver/json_interface.c index 2ad97901c..b6a7ad3d6 100644 --- a/src/httpserver/json_interface.c +++ b/src/httpserver/json_interface.c @@ -560,7 +560,7 @@ static int http_tasmota_json_status_NET(void* request, jsonCb_t printer) { printer(request, "\"StatusNET\":{"); JSON_PrintKeyValue_String(request, printer, "Hostname", CFG_GetShortDeviceName(), true); JSON_PrintKeyValue_String(request, printer, "IPAddress", HAL_GetMyIPString(), true); -#if 0 +#if PLATFORM_BEKEN JSON_PrintKeyValue_String(request, printer, "Gateway", HAL_GetMyGatewayString(), true); JSON_PrintKeyValue_String(request, printer, "Subnetmask", HAL_GetMyMaskString(), true); JSON_PrintKeyValue_String(request, printer, "DNSServer1", HAL_GetMyDNSString(), true);