From 94e79b8fa28920c502e9346b4d439c7320e41856 Mon Sep 17 00:00:00 2001 From: Marcus Date: Wed, 23 Oct 2024 21:21:26 +0200 Subject: [PATCH] replacing all old configSystem style variables with config.system.something --- Arduino/CanGrow/CanGrow.ino | 6 +- Arduino/CanGrow/include/CanGrow_LittleFS.h | 100 +++++++------- Arduino/CanGrow/include/CanGrow_Webserver.h | 2 +- Arduino/CanGrow/include/CanGrow_Wifi.h | 28 ++-- Arduino/CanGrow/include/Webserver/Common.h | 2 +- .../CanGrow/include/Webserver/Page_system.h | 4 +- Arduino/CanGrow/include/Webserver/Page_wifi.h | 128 +++++++++--------- .../include/Webserver/Page_wifi_HTML.h | 38 +++--- 8 files changed, 154 insertions(+), 154 deletions(-) diff --git a/Arduino/CanGrow/CanGrow.ino b/Arduino/CanGrow/CanGrow.ino index 456fb60..4086534 100644 --- a/Arduino/CanGrow/CanGrow.ino +++ b/Arduino/CanGrow/CanGrow.ino @@ -143,14 +143,14 @@ bool alrdySaved = false; void loop() { unsigned long currentMillis = millis(); - if(currentMillis - schedulerPrevMillis >= configSystem.schedulerInterval) { + if(currentMillis - schedulerPrevMillis >= config.system.schedulerInterval) { } if((digitalRead(PinWIPE) != PinWIPE_default) && (alrdySaved == false)) { - Serial.println(":: [LOOP] PinWIPE is triggered, saving config.json and set configSystem.httpLogSerial to true"); - configSystem.httpLogSerial = true; + Serial.println(":: [LOOP] PinWIPE is triggered, saving config.json and set config.system.httpLogSerial to true"); + config.system.httpLogSerial = true; // save config to littlefs as json SaveConfig(); // only print json to serial diff --git a/Arduino/CanGrow/include/CanGrow_LittleFS.h b/Arduino/CanGrow/include/CanGrow_LittleFS.h index 71e9058..2d08c39 100644 --- a/Arduino/CanGrow/include/CanGrow_LittleFS.h +++ b/Arduino/CanGrow/include/CanGrow_LittleFS.h @@ -181,43 +181,43 @@ bool LoadConfig() { // * WiFi * JsonObject objWifi = doc["wifi"][0]; - strlcpy(configWifi.ssid, objWifi["ssid"], sizeof(configWifi.ssid)); - strlcpy(configWifi.password, objWifi["password"], sizeof(configWifi.password)); + strlcpy(config.wifi.ssid, objWifi["ssid"], sizeof(config.wifi.ssid)); + strlcpy(config.wifi.password, objWifi["password"], sizeof(config.wifi.password)); // Copy bool / int directly into struct - configWifi.dhcp = objWifi["dhcp"]; + config.wifi.dhcp = objWifi["dhcp"]; // load the ip addresses as array int i; for(i=0; i <4 ; i++) { - configWifi.ip[i] = objWifi["ip"][i]; - configWifi.netmask[i] = objWifi["netmask"][i]; - configWifi.gateway[i] = objWifi["gateway"][i]; - configWifi.dns[i] = objWifi["dns"][i]; + config.wifi.ip[i] = objWifi["ip"][i]; + config.wifi.netmask[i] = objWifi["netmask"][i]; + config.wifi.gateway[i] = objWifi["gateway"][i]; + config.wifi.dns[i] = objWifi["dns"][i]; } // * System * JsonObject objSystem = doc["system"][0]; - configSystem.ntpOffset = objSystem["ntpOffset"]; - configSystem.maintenanceDuration = objSystem["maintenanceDuration"]; - strlcpy(configSystem.esp32camIp, objSystem["esp32camIp"], sizeof(configSystem.esp32camIp)); - strlcpy(configSystem.httpUser, objSystem["httpUser"], sizeof(configSystem.httpUser)); - strlcpy(configSystem.httpPass, objSystem["httpPass"], sizeof(configSystem.httpPass)); - configSystem.httpLogSerial = objSystem["httpLogSerial"]; - configSystem.schedulerInterval = objSystem["schedulerInterval"]; + config.system.ntpOffset = objSystem["ntpOffset"]; + config.system.maintenanceDuration = objSystem["maintenanceDuration"]; + strlcpy(config.system.esp32camIp, objSystem["esp32camIp"], sizeof(config.system.esp32camIp)); + strlcpy(config.system.httpUser, objSystem["httpUser"], sizeof(config.system.httpUser)); + strlcpy(config.system.httpPass, objSystem["httpPass"], sizeof(config.system.httpPass)); + config.system.httpLogSerial = objSystem["httpLogSerial"]; + config.system.schedulerInterval = objSystem["schedulerInterval"]; // * Grow * JsonObject objGrow = doc["grow"][0]; - strlcpy(configGrow.growName, objGrow["growName"], sizeof(configGrow.growName)); - configGrow.dayOfGrow = objGrow["dayOfGrow"]; - configGrow.daysSeed = objGrow["daysSeed"]; - configGrow.daysVeg = objGrow["daysVeg"]; - configGrow.daysBloom = objGrow["daysBloom"]; - configGrow.lightHoursVeg = objGrow["lightHoursVeg"]; - configGrow.lightHoursBloom = objGrow["lightHoursBloom"]; - configGrow.sunriseHour = objGrow["sunriseHour"]; - configGrow.sunriseMinute = objGrow["sunriseMinute"]; - configGrow.sunFade = objGrow["sunFade"]; - configGrow.sunFadeDuration = objGrow["sunFadeDuration"]; + strlcpy(config.grow.growName, objGrow["growName"], sizeof(config.grow.growName)); + config.grow.dayOfGrow = objGrow["dayOfGrow"]; + config.grow.daysSeed = objGrow["daysSeed"]; + config.grow.daysVeg = objGrow["daysVeg"]; + config.grow.daysBloom = objGrow["daysBloom"]; + config.grow.lightHoursVeg = objGrow["lightHoursVeg"]; + config.grow.lightHoursBloom = objGrow["lightHoursBloom"]; + config.grow.sunriseHour = objGrow["sunriseHour"]; + config.grow.sunriseMinute = objGrow["sunriseMinute"]; + config.grow.sunFade = objGrow["sunFade"]; + config.grow.sunFadeDuration = objGrow["sunFadeDuration"]; @@ -238,41 +238,41 @@ bool SaveConfig(bool writeToSerial = false) { // * WiFi * JsonObject objWifi = doc["wifi"].add(); - objWifi["ssid"] = configWifi.ssid; - objWifi["password"] = configWifi.password; + objWifi["ssid"] = config.wifi.ssid; + objWifi["password"] = config.wifi.password; // save the ip addressess as array int i; for(i=0; i <4 ; i++) { - objWifi["ip"][i] = configWifi.ip[i]; - objWifi["netmask"][i] = configWifi.netmask[i]; - objWifi["gateway"][i] = configWifi.gateway[i]; - objWifi["dns"][i] = configWifi.dns[i]; + objWifi["ip"][i] = config.wifi.ip[i]; + objWifi["netmask"][i] = config.wifi.netmask[i]; + objWifi["gateway"][i] = config.wifi.gateway[i]; + objWifi["dns"][i] = config.wifi.dns[i]; } - objWifi["dhcp"] = configWifi.dhcp; + objWifi["dhcp"] = config.wifi.dhcp; // * System * JsonObject objSystem = doc["system"].add(); - objSystem["ntpOffset"] = configSystem.ntpOffset; - objSystem["maintenanceDuration"] = configSystem.maintenanceDuration; - objSystem["esp32camIp"] = configSystem.esp32camIp; - objSystem["httpUser"] = configSystem.httpUser; - objSystem["httpPass"] = configSystem.httpPass; - objSystem["httpLogSerial"] = configSystem.httpLogSerial; - objSystem["schedulerInterval"] = configSystem.schedulerInterval; + objSystem["ntpOffset"] = config.system.ntpOffset; + objSystem["maintenanceDuration"] = config.system.maintenanceDuration; + objSystem["esp32camIp"] = config.system.esp32camIp; + objSystem["httpUser"] = config.system.httpUser; + objSystem["httpPass"] = config.system.httpPass; + objSystem["httpLogSerial"] = config.system.httpLogSerial; + objSystem["schedulerInterval"] = config.system.schedulerInterval; // * Grow * JsonObject objGrow = doc["grow"].add(); - objGrow["growName"] = configGrow.growName; - objGrow["dayOfGrow"] = configGrow.dayOfGrow; - objGrow["daysSeed"] = configGrow.daysSeed; - objGrow["daysVeg"] = configGrow.daysVeg; - objGrow["daysBloom"] = configGrow.daysBloom; - objGrow["lightHoursVeg"] = configGrow.lightHoursVeg; - objGrow["lightHoursBloom"] = configGrow.lightHoursBloom; - objGrow["sunriseHour"] = configGrow.sunriseHour; - objGrow["sunriseMinute"] = configGrow.sunriseMinute; - objGrow["sunFade"] = configGrow.sunFade; - objGrow["sunFadeDuration"] = configGrow.sunFadeDuration; + objGrow["growName"] = config.grow.growName; + objGrow["dayOfGrow"] = config.grow.dayOfGrow; + objGrow["daysSeed"] = config.grow.daysSeed; + objGrow["daysVeg"] = config.grow.daysVeg; + objGrow["daysBloom"] = config.grow.daysBloom; + objGrow["lightHoursVeg"] = config.grow.lightHoursVeg; + objGrow["lightHoursBloom"] = config.grow.lightHoursBloom; + objGrow["sunriseHour"] = config.grow.sunriseHour; + objGrow["sunriseMinute"] = config.grow.sunriseMinute; + objGrow["sunFade"] = config.grow.sunFade; + objGrow["sunFadeDuration"] = config.grow.sunFadeDuration; /* * END Building config.json here diff --git a/Arduino/CanGrow/include/CanGrow_Webserver.h b/Arduino/CanGrow/include/CanGrow_Webserver.h index 7cf1840..ba139f3 100644 --- a/Arduino/CanGrow/include/CanGrow_Webserver.h +++ b/Arduino/CanGrow/include/CanGrow_Webserver.h @@ -101,7 +101,7 @@ void Webserver_Init() { requestLogger.setOutput(Serial); // this activates the middleware - if(configSystem.httpLogSerial == true) { + if(config.system.httpLogSerial == true) { Serial.println(":: [Webserver] serial logging: enabled"); webserver.addMiddleware(&requestLogger); } else { diff --git a/Arduino/CanGrow/include/CanGrow_Wifi.h b/Arduino/CanGrow/include/CanGrow_Wifi.h index ae6d1c8..97dd73c 100644 --- a/Arduino/CanGrow/include/CanGrow_Wifi.h +++ b/Arduino/CanGrow/include/CanGrow_Wifi.h @@ -29,16 +29,16 @@ void Wifi_Connect() { - Serial.printf(":: [WiFi] connecting to SSID: %s\n", configWifi.ssid); - WiFi.begin(configWifi.ssid, configWifi.password); - if(configWifi.dhcp == false) { + Serial.printf(":: [WiFi] connecting to SSID: %s\n", config.wifi.ssid); + WiFi.begin(config.wifi.ssid, config.wifi.password); + if(config.wifi.dhcp == false) { Serial.println(":: [WiFi] using static ip configuration:"); - Serial.printf(":: [WiFi] IP : %s\n", IP2Char(configWifi.ip)); - Serial.printf(":: [WiFi] Netmask: %s\n", IP2Char(configWifi.netmask)); - Serial.printf(":: [WiFi] Gateway: %s\n", IP2Char(configWifi.gateway)); - Serial.printf(":: [WiFi] DNS : %s\n", IP2Char(configWifi.dns)); + Serial.printf(":: [WiFi] IP : %s\n", IP2Char(config.wifi.ip)); + Serial.printf(":: [WiFi] Netmask: %s\n", IP2Char(config.wifi.netmask)); + Serial.printf(":: [WiFi] Gateway: %s\n", IP2Char(config.wifi.gateway)); + Serial.printf(":: [WiFi] DNS : %s\n", IP2Char(config.wifi.dns)); - WiFi.config(configWifi.ip, configWifi.dns, configWifi.gateway, configWifi.netmask); + WiFi.config(config.wifi.ip, config.wifi.dns, config.wifi.gateway, config.wifi.netmask); } else { Serial.println(":: [WiFi] using DHCP for ip configuration"); } @@ -51,7 +51,7 @@ void Wifi_Connect() { } Serial.println("CONNECTED!"); - if(configWifi.dhcp == true) { + if(config.wifi.dhcp == true) { Serial.println(":: [WiFi] DHCP offered ip configuration:"); Serial.printf(":: [WiFi] IP : %s\n", IP2Char(WiFi.localIP())); Serial.printf(":: [WiFi] Netmask: %s\n", IP2Char(WiFi.subnetMask())); @@ -63,17 +63,17 @@ void Wifi_Connect() { void Wifi_AP() { Serial.printf(":: [WiFi] create access point: %s\n", CANGROW_SSID); - WiFi.softAPConfig(configWifi.ip, configWifi.gateway, configWifi.netmask); + WiFi.softAPConfig(config.wifi.ip, config.wifi.gateway, config.wifi.netmask); WiFi.softAP(CANGROW_SSID); Serial.println(":: [WiFi] access point started:"); - Serial.printf(":: [WiFi] IP : %s\n", IP2Char(configWifi.ip)); - Serial.printf(":: [WiFi] Netmask: %s\n", IP2Char(configWifi.netmask)); + Serial.printf(":: [WiFi] IP : %s\n", IP2Char(config.wifi.ip)); + Serial.printf(":: [WiFi] Netmask: %s\n", IP2Char(config.wifi.netmask)); } void Wifi_Init() { Serial.println(":: [WiFi] initializing"); - if(strlen(configWifi.ssid) == 0) { - Serial.println(":: [WiFi] configWifi.ssid is unset"); + if(strlen(config.wifi.ssid) == 0) { + Serial.println(":: [WiFi] config.wifi.ssid is unset"); Wifi_AP(); } else { Wifi_Connect(); diff --git a/Arduino/CanGrow/include/Webserver/Common.h b/Arduino/CanGrow/include/Webserver/Common.h index db28d78..74935a2 100644 --- a/Arduino/CanGrow/include/Webserver/Common.h +++ b/Arduino/CanGrow/include/Webserver/Common.h @@ -60,7 +60,7 @@ String AddHeaderFooter(const String& var) { } else if(var == "CGBUILD") { return String(CANGROW_BUILD); } else if(var == "GROWNAME") { - return String(configGrow.growName); + return String(config.grow.growName); } else if(var == "CANGROW_CSS") { return String(File_cangrow_CSS); } else if(var == "NEED_RESTART") { diff --git a/Arduino/CanGrow/include/Webserver/Page_system.h b/Arduino/CanGrow/include/Webserver/Page_system.h index 99b1905..dc1e953 100644 --- a/Arduino/CanGrow/include/Webserver/Page_system.h +++ b/Arduino/CanGrow/include/Webserver/Page_system.h @@ -122,10 +122,10 @@ void WebPage_system_update_ApplyUpdate(AsyncWebServerRequest *request, String fi String Proc_WebPage_system_update_POST(const String& var) { if(var == "CONFIGWIFI_IP") { - if(configWifi.dhcp == true) { + if(config.wifi.dhcp == true) { return WiFi.localIP().toString(); } else { - return String(IP2Char(configWifi.ip)); + return String(IP2Char(config.wifi.ip)); } } else { return String(); diff --git a/Arduino/CanGrow/include/Webserver/Page_wifi.h b/Arduino/CanGrow/include/Webserver/Page_wifi.h index 3f49715..76ee5bc 100644 --- a/Arduino/CanGrow/include/Webserver/Page_wifi.h +++ b/Arduino/CanGrow/include/Webserver/Page_wifi.h @@ -58,15 +58,15 @@ String Proc_WebPage_wifi(const String& var) { return AddHeaderFooter(var); //CURRENT_SETTINGS } else if(var == "CURRENT_SETTINGS") { - if(strlen(configWifi.ssid) > 0) { + if(strlen(config.wifi.ssid) > 0) { return String(Page_wifi_HTML_CURRENT_SETTINGS); } else { return String(); } } else if(var == "CONFIGWIFI_SSID") { - return String(configWifi.ssid); + return String(config.wifi.ssid); } else if(var == "CONFIGWIFI_DHCP") { - return String(configWifi.dhcp); + return String(config.wifi.dhcp); } else if(var == "CONFIGWIFI_IP") { return String(WiFi.localIP().toString()); } else if(var == "CONFIGWIFI_NETMASK") { @@ -102,93 +102,93 @@ String Proc_WebPage_wifi_POST_ERR(const String& var) { void WebPage_wifi(AsyncWebServerRequest *request) { if(request->method() == HTTP_POST) { - if(request->hasParam("configWifi.ssid", true)) { - const AsyncWebParameter* p_ssid = request->getParam("configWifi.ssid", true); + if(request->hasParam("config.wifi.ssid", true)) { + const AsyncWebParameter* p_ssid = request->getParam("config.wifi.ssid", true); Serial.printf(":: [Webserver:wifi] POST[%s]: %s\n", p_ssid->name().c_str(), p_ssid->value().c_str()); - strlcpy(configWifi.ssid, p_ssid->value().c_str(), sizeof(configWifi.ssid)); + strlcpy(config.wifi.ssid, p_ssid->value().c_str(), sizeof(config.wifi.ssid)); } - if(request->hasParam("configWifi.password", true)) { - const AsyncWebParameter* p_password = request->getParam("configWifi.password", true); + if(request->hasParam("config.wifi.password", true)) { + const AsyncWebParameter* p_password = request->getParam("config.wifi.password", true); Serial.printf(":: [Webserver:wifi] POST[%s]: %s\n", p_password->name().c_str(), p_password->value().c_str()); - strlcpy(configWifi.password, p_password->value().c_str(), sizeof(configWifi.password)); + strlcpy(config.wifi.password, p_password->value().c_str(), sizeof(config.wifi.password)); } if( - (request->hasParam("configWifi.ip0", true)) && - (request->hasParam("configWifi.ip1", true)) && - (request->hasParam("configWifi.ip2", true)) && - (request->hasParam("configWifi.ip3", true))) { + (request->hasParam("config.wifi.ip0", true)) && + (request->hasParam("config.wifi.ip1", true)) && + (request->hasParam("config.wifi.ip2", true)) && + (request->hasParam("config.wifi.ip3", true))) { - const AsyncWebParameter* p_ip0 = request->getParam("configWifi.ip0", true); - const AsyncWebParameter* p_ip1 = request->getParam("configWifi.ip1", true); - const AsyncWebParameter* p_ip2 = request->getParam("configWifi.ip2", true); - const AsyncWebParameter* p_ip3 = request->getParam("configWifi.ip3", true); - Serial.printf(":: [Webserver:wifi] POST[configWifi.ip0-3]: %s . %s . %s . %s\n", p_ip0->value().c_str(), p_ip1->value().c_str(), p_ip2->value().c_str(), p_ip3->value().c_str()); - configWifi.ip[0] = p_ip0->value().toInt(); - configWifi.ip[1] = p_ip1->value().toInt(); - configWifi.ip[2] = p_ip2->value().toInt(); - configWifi.ip[3] = p_ip3->value().toInt(); + const AsyncWebParameter* p_ip0 = request->getParam("config.wifi.ip0", true); + const AsyncWebParameter* p_ip1 = request->getParam("config.wifi.ip1", true); + const AsyncWebParameter* p_ip2 = request->getParam("config.wifi.ip2", true); + const AsyncWebParameter* p_ip3 = request->getParam("config.wifi.ip3", true); + Serial.printf(":: [Webserver:wifi] POST[config.wifi.ip0-3]: %s . %s . %s . %s\n", p_ip0->value().c_str(), p_ip1->value().c_str(), p_ip2->value().c_str(), p_ip3->value().c_str()); + config.wifi.ip[0] = p_ip0->value().toInt(); + config.wifi.ip[1] = p_ip1->value().toInt(); + config.wifi.ip[2] = p_ip2->value().toInt(); + config.wifi.ip[3] = p_ip3->value().toInt(); } if( - (request->hasParam("configWifi.netmask0", true)) && - (request->hasParam("configWifi.netmask1", true)) && - (request->hasParam("configWifi.netmask2", true)) && - (request->hasParam("configWifi.netmask3", true))) { + (request->hasParam("config.wifi.netmask0", true)) && + (request->hasParam("config.wifi.netmask1", true)) && + (request->hasParam("config.wifi.netmask2", true)) && + (request->hasParam("config.wifi.netmask3", true))) { - const AsyncWebParameter* p_netmask0 = request->getParam("configWifi.netmask0", true); - const AsyncWebParameter* p_netmask1 = request->getParam("configWifi.netmask1", true); - const AsyncWebParameter* p_netmask2 = request->getParam("configWifi.netmask2", true); - const AsyncWebParameter* p_netmask3 = request->getParam("configWifi.netmask3", true); - Serial.printf(":: [Webserver:wifi] POST[configWifi.netmask0-3]: %s . %s . %s . %s\n", p_netmask0->value().c_str(), p_netmask1->value().c_str(), p_netmask2->value().c_str(), p_netmask3->value().c_str()); - configWifi.netmask[0] = p_netmask0->value().toInt(); - configWifi.netmask[1] = p_netmask1->value().toInt(); - configWifi.netmask[2] = p_netmask2->value().toInt(); - configWifi.netmask[3] = p_netmask3->value().toInt(); + const AsyncWebParameter* p_netmask0 = request->getParam("config.wifi.netmask0", true); + const AsyncWebParameter* p_netmask1 = request->getParam("config.wifi.netmask1", true); + const AsyncWebParameter* p_netmask2 = request->getParam("config.wifi.netmask2", true); + const AsyncWebParameter* p_netmask3 = request->getParam("config.wifi.netmask3", true); + Serial.printf(":: [Webserver:wifi] POST[config.wifi.netmask0-3]: %s . %s . %s . %s\n", p_netmask0->value().c_str(), p_netmask1->value().c_str(), p_netmask2->value().c_str(), p_netmask3->value().c_str()); + config.wifi.netmask[0] = p_netmask0->value().toInt(); + config.wifi.netmask[1] = p_netmask1->value().toInt(); + config.wifi.netmask[2] = p_netmask2->value().toInt(); + config.wifi.netmask[3] = p_netmask3->value().toInt(); } if( - (request->hasParam("configWifi.gateway0", true)) && - (request->hasParam("configWifi.gateway1", true)) && - (request->hasParam("configWifi.gateway2", true)) && - (request->hasParam("configWifi.gateway3", true))) { + (request->hasParam("config.wifi.gateway0", true)) && + (request->hasParam("config.wifi.gateway1", true)) && + (request->hasParam("config.wifi.gateway2", true)) && + (request->hasParam("config.wifi.gateway3", true))) { - const AsyncWebParameter* p_gateway0 = request->getParam("configWifi.gateway0", true); - const AsyncWebParameter* p_gateway1 = request->getParam("configWifi.gateway1", true); - const AsyncWebParameter* p_gateway2 = request->getParam("configWifi.gateway2", true); - const AsyncWebParameter* p_gateway3 = request->getParam("configWifi.gateway3", true); - Serial.printf(":: [Webserver:wifi] POST[configWifi.gateway0-3]: %s . %s . %s . %s\n", p_gateway0->value().c_str(), p_gateway1->value().c_str(), p_gateway2->value().c_str(), p_gateway3->value().c_str()); - configWifi.gateway[0] = p_gateway0->value().toInt(); - configWifi.gateway[1] = p_gateway1->value().toInt(); - configWifi.gateway[2] = p_gateway2->value().toInt(); - configWifi.gateway[3] = p_gateway3->value().toInt(); + const AsyncWebParameter* p_gateway0 = request->getParam("config.wifi.gateway0", true); + const AsyncWebParameter* p_gateway1 = request->getParam("config.wifi.gateway1", true); + const AsyncWebParameter* p_gateway2 = request->getParam("config.wifi.gateway2", true); + const AsyncWebParameter* p_gateway3 = request->getParam("config.wifi.gateway3", true); + Serial.printf(":: [Webserver:wifi] POST[config.wifi.gateway0-3]: %s . %s . %s . %s\n", p_gateway0->value().c_str(), p_gateway1->value().c_str(), p_gateway2->value().c_str(), p_gateway3->value().c_str()); + config.wifi.gateway[0] = p_gateway0->value().toInt(); + config.wifi.gateway[1] = p_gateway1->value().toInt(); + config.wifi.gateway[2] = p_gateway2->value().toInt(); + config.wifi.gateway[3] = p_gateway3->value().toInt(); } if( - (request->hasParam("configWifi.dns0", true)) && - (request->hasParam("configWifi.dns1", true)) && - (request->hasParam("configWifi.dns2", true)) && - (request->hasParam("configWifi.dns3", true))) { + (request->hasParam("config.wifi.dns0", true)) && + (request->hasParam("config.wifi.dns1", true)) && + (request->hasParam("config.wifi.dns2", true)) && + (request->hasParam("config.wifi.dns3", true))) { - const AsyncWebParameter* p_dns0 = request->getParam("configWifi.dns0", true); - const AsyncWebParameter* p_dns1 = request->getParam("configWifi.dns1", true); - const AsyncWebParameter* p_dns2 = request->getParam("configWifi.dns2", true); - const AsyncWebParameter* p_dns3 = request->getParam("configWifi.dns3", true); - Serial.printf(":: [Webserver:wifi] POST[configWifi.dns0-3]: %s . %s . %s . %s\n", p_dns0->value().c_str(), p_dns1->value().c_str(), p_dns2->value().c_str(), p_dns3->value().c_str()); - configWifi.dns[0] = p_dns0->value().toInt(); - configWifi.dns[1] = p_dns1->value().toInt(); - configWifi.dns[2] = p_dns2->value().toInt(); - configWifi.dns[3] = p_dns3->value().toInt(); + const AsyncWebParameter* p_dns0 = request->getParam("config.wifi.dns0", true); + const AsyncWebParameter* p_dns1 = request->getParam("config.wifi.dns1", true); + const AsyncWebParameter* p_dns2 = request->getParam("config.wifi.dns2", true); + const AsyncWebParameter* p_dns3 = request->getParam("config.wifi.dns3", true); + Serial.printf(":: [Webserver:wifi] POST[config.wifi.dns0-3]: %s . %s . %s . %s\n", p_dns0->value().c_str(), p_dns1->value().c_str(), p_dns2->value().c_str(), p_dns3->value().c_str()); + config.wifi.dns[0] = p_dns0->value().toInt(); + config.wifi.dns[1] = p_dns1->value().toInt(); + config.wifi.dns[2] = p_dns2->value().toInt(); + config.wifi.dns[3] = p_dns3->value().toInt(); } - if(request->hasParam("configWifi.dhcp", true)) { - const AsyncWebParameter* p_dhcp = request->getParam("configWifi.dhcp", true); + if(request->hasParam("config.wifi.dhcp", true)) { + const AsyncWebParameter* p_dhcp = request->getParam("config.wifi.dhcp", true); Serial.printf(":: [Webserver:wifi] POST[%s]: %s\n", p_dhcp->name().c_str(), p_dhcp->value().c_str()); - configWifi.dhcp = p_dhcp->value().toInt(); + config.wifi.dhcp = p_dhcp->value().toInt(); } if(SaveConfig()) { diff --git a/Arduino/CanGrow/include/Webserver/Page_wifi_HTML.h b/Arduino/CanGrow/include/Webserver/Page_wifi_HTML.h index 88e21f2..d4c734b 100644 --- a/Arduino/CanGrow/include/Webserver/Page_wifi_HTML.h +++ b/Arduino/CanGrow/include/Webserver/Page_wifi_HTML.h @@ -38,7 +38,7 @@ const char* Page_wifi_HTML PROGMEM = R"(%HEADER%
SSID:
- %WIFI_LIST% @@ -46,38 +46,38 @@ const char* Page_wifi_HTML PROGMEM = R"(%HEADER%
Password:
-
+
DHCP:
-
IP:
- . - . - . -
+ . + . + . +
Netmask:
- . - . - . -
+ . + . + . +
Gateway:
- . - . - . -
+ . + . + . +
DNS:
- . - . - . -
+ . + . + . +