diff --git a/Kconfig b/Kconfig index f6e3e4f..2c3f773 100644 --- a/Kconfig +++ b/Kconfig @@ -54,6 +54,14 @@ menu "WebGUIApp" default n help This will reset to default settings on every startup + + menu "Web UI settings" + config WEBGUIAPP_ACCENT_COLOR + string "Accent color code for web ui" + default "#dba617" + help + Set accent color for user web ui + endmenu menu "OTA settings" config WEBGUIAPP_OTA_AUTOUPDATE_ENABLE @@ -84,11 +92,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" @@ -104,7 +124,24 @@ menu "WebGUIApp" help Timezone in hours. Positive for East and negative for the West endmenu - + + menu "CRON settings" + config WEBGUIAPP_CRON_ENABLE + bool "Enabled CRON scheduler" + default y + help + Include CRON functionality into firmware + + if WEBGUIAPP_CRON_ENABLE + + config WEBGUIAPP_CRON_NUMBER + int "CRON tasks number" + range 1 32 + default 16 + help + Max number of CRON schedulers in the system + endif + endmenu menu "SPI settings" @@ -431,7 +468,7 @@ menu "WebGUIApp" config ETH_SPI_INT0_GPIO int "Interrupt GPIO number SPI Ethernet module #1" - range 0 39 + range GPIO_RANGE_MIN GPIO_RANGE_MAX default 4 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3 help Set the GPIO number used by the first SPI Ethernet module interrupt line. @@ -439,7 +476,7 @@ menu "WebGUIApp" config ETH_SPI_INT1_GPIO depends on SPI_ETHERNETS_NUM > 1 int "Interrupt GPIO number SPI Ethernet module #2" - range 0 36 + range GPIO_RANGE_MIN GPIO_RANGE_MAX default 33 if IDF_TARGET_ESP32 default 5 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3 help diff --git a/include/WebGUIAppMain.h b/include/WebGUIAppMain.h index 1de696e..32d20d6 100644 --- a/include/WebGUIAppMain.h +++ b/include/WebGUIAppMain.h @@ -66,6 +66,8 @@ { int TimeZone; char SntpServerAdr[33]; + char SntpServer2Adr[33]; + char SntpServer3Adr[33]; struct { char b1 :1; diff --git a/src/HTTPPostSystem.c b/src/HTTPPostSystem.c index a129521..bc53847 100644 --- a/src/HTTPPostSystem.c +++ b/src/HTTPPostSystem.c @@ -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) diff --git a/src/HTTPPrintSystem.c b/src/HTTPPrintSystem.c index 76973fb..99076a5 100644 --- a/src/HTTPPrintSystem.c +++ b/src/HTTPPrintSystem.c @@ -116,6 +116,12 @@ static void PrintCheckbox(char *VarData, void *arg, bool checked) snprintf(VarData, MAX_DYNVAR_LENGTH, " "); } +static void HTTPPrint_actclr(char *VarData, void *arg) +{ + snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", CONFIG_WEBGUIAPP_ACCENT_COLOR); +} + + static void HTTPPrint_name(char *VarData, void *arg) { snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", CONFIG_DEVICE_MODEL_NAME); @@ -617,6 +623,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) { @@ -705,7 +719,10 @@ static void HTTPPrint_DEF(char *VarData, void *arg) } dyn_var_handler_t HANDLERS_ARRAY[] = { - /*Ststem settings*/ + /*GUI settings*/ + { "actclr", sizeof("actclr") - 1, &HTTPPrint_actclr }, + + /*System settings*/ { "name", sizeof("name") - 1, &HTTPPrint_name }, { "dname", sizeof("dname") - 1, &HTTPPrint_dname }, { "login", sizeof("login") - 1, &HTTPPrint_login }, @@ -821,6 +838,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 }, diff --git a/src/HTTPServer.c b/src/HTTPServer.c index f13d364..b0a4cd3 100644 --- a/src/HTTPServer.c +++ b/src/HTTPServer.c @@ -355,7 +355,10 @@ static esp_err_t GETHandler(httpd_req_t *req) } //check if the file can contains dynamic variables - if (IS_FILE_EXT(filename, ".html") || IS_FILE_EXT(filename, ".json") || IS_FILE_EXT(filename, ".js")) + if (IS_FILE_EXT(filename, ".html") || + IS_FILE_EXT(filename, ".json") || + IS_FILE_EXT(filename, ".css") || + IS_FILE_EXT(filename, ".js")) isDynamicVars = true; do { diff --git a/src/SNTP.c b/src/SNTP.c index f619ee0..c0b7a43 100644 --- a/src/SNTP.c +++ b/src/SNTP.c @@ -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(); diff --git a/src/WebGUIAppMain.c b/src/WebGUIAppMain.c index 5d3bd87..20f997e 100644 --- a/src/WebGUIAppMain.c +++ b/src/WebGUIAppMain.c @@ -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;