From 55ada7fd5227b16d6427da1d1a6b6a7ea0eac914 Mon Sep 17 00:00:00 2001 From: Bogdan Pilyugin Date: Thu, 11 May 2023 16:09:43 +0200 Subject: [PATCH 1/4] fix range of gpio's for esp32-s3 chips --- Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kconfig b/Kconfig index f6e3e4f..0604b0f 100644 --- a/Kconfig +++ b/Kconfig @@ -431,7 +431,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 +439,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 From 5f8f2be7b069abbcbfc68f837cbce088883df726 Mon Sep 17 00:00:00 2001 From: bogdan Date: Tue, 16 May 2023 08:06:56 +0200 Subject: [PATCH 2/4] added cron in global configuration --- Kconfig | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Kconfig b/Kconfig index 0604b0f..5d6fa1c 100644 --- a/Kconfig +++ b/Kconfig @@ -104,7 +104,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" From a856034f1de3a1395844b205251b9e2c13cb2ba2 Mon Sep 17 00:00:00 2001 From: bogdan Date: Sat, 20 May 2023 19:27:37 +0200 Subject: [PATCH 3/4] added more SNTP servers for reservation --- Kconfig | 18 +++++++++++++++--- include/WebGUIAppMain.h | 2 ++ src/HTTPPostSystem.c | 4 ++++ src/HTTPPrintSystem.c | 10 ++++++++++ src/SNTP.c | 4 +++- src/WebGUIAppMain.c | 8 ++++++-- 6 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Kconfig b/Kconfig index 5d6fa1c..ba932ab 100644 --- a/Kconfig +++ b/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" 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..3e0bd4a 100644 --- a/src/HTTPPrintSystem.c +++ b/src/HTTPPrintSystem.c @@ -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 }, 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; From ab665c8e8acf60a1ffb0afaecbe458c72011ac39 Mon Sep 17 00:00:00 2001 From: bogdan Date: Mon, 22 May 2023 09:15:51 +0200 Subject: [PATCH 4/4] added web ui accent color to the global configuration --- Kconfig | 8 ++++++++ src/HTTPPrintSystem.c | 11 ++++++++++- src/HTTPServer.c | 5 ++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Kconfig b/Kconfig index ba932ab..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 diff --git a/src/HTTPPrintSystem.c b/src/HTTPPrintSystem.c index 3e0bd4a..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); @@ -713,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 }, 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 {