diff --git a/.gitignore b/.gitignore
index 0a20f3a..712d94d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,4 @@ KiCad/CanGrow/CanGrow.kicad_sch-bak
KiCad/CanGrow/fp-info-cache
KiCad/CanGrow/gerber/*.zip
Arduino/CanGrow/CanGrow.geany
-build/
+Arduino/CanGrow/build/
diff --git a/Arduino/CanGrow/include/Webserver/Page_system.h b/Arduino/CanGrow/include/Webserver/Page_system.h
index 7b248c8..2dd3f29 100644
--- a/Arduino/CanGrow/include/Webserver/Page_system.h
+++ b/Arduino/CanGrow/include/Webserver/Page_system.h
@@ -91,9 +91,10 @@ void WebPage_system_restart(AsyncWebServerRequest *request) {
* Subpage update
*/
+// https://github.com/mathieucarbou/ESPAsyncWebServer/blob/main/docs/index.md#setting-up-the-server
void WebPage_system_update_ApplyUpdate(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final){
if(!index){
- Serial.printf("Update Start: %s\n", filename.c_str());
+ Serial.printf(":: [Webserver:system:update:ApplyUpdate] Update Start: %s\n", filename.c_str());
Update.runAsync(true);
if(!Update.begin((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000)){
Update.printError(Serial);
@@ -106,17 +107,29 @@ void WebPage_system_update_ApplyUpdate(AsyncWebServerRequest *request, String fi
}
if(final){
if(Update.end(true)){
- Serial.printf("Update Success: %uB\n", index+len);
+ Serial.printf(":: [Webserver:system:update:ApplyUpdate] Update Success: %uB\n", index+len);
} else {
Update.printError(Serial);
}
}
}
+String Proc_WebPage_system_update_POST(const String& var) {
+ if(var == "CONFIGWIFI_IP") {
+ if(configWifi.dhcp == true) {
+ return WiFi.localIP().toString();
+ } else {
+ return String(IP2Char(configWifi.ip));
+ }
+ } else {
+ return String();
+ }
+}
+
void WebPage_system_update(AsyncWebServerRequest *request) {
if(request->method() == HTTP_POST) {
- needRestart = !Update.hasError();
- AsyncWebServerResponse *response = request->beginResponse(200, "text/plain", needRestart?"OK":"FAIL");
+ doRestart = !Update.hasError();
+ AsyncWebServerResponse *response = request->beginResponse(200, "text/html", doRestart?Page_system_update_HTML_POST:"UPDATE FAILED", Proc_WebPage_system_update_POST);
response->addHeader("Connection", "close");
request->send(response);
} else {
diff --git a/Arduino/CanGrow/include/Webserver/Page_system_HTML.h b/Arduino/CanGrow/include/Webserver/Page_system_HTML.h
index 93b7054..612c4c2 100644
--- a/Arduino/CanGrow/include/Webserver/Page_system_HTML.h
+++ b/Arduino/CanGrow/include/Webserver/Page_system_HTML.h
@@ -92,6 +92,15 @@ Build : %CGBUILD%
%FOOTER%)";
+const char* Page_system_update_HTML_POST PROGMEM = R"(
+