diff --git a/Arduino/CanGrow/CanGrow_Version.h b/Arduino/CanGrow/CanGrow_Version.h index c0088f5..c59454b 100644 --- a/Arduino/CanGrow/CanGrow_Version.h +++ b/Arduino/CanGrow/CanGrow_Version.h @@ -1,5 +1,5 @@ /* CanGrow_Version.h gets generated from cangrow.sh */ const char* CanGrowVer = "0.1-dev"; -const char* CanGrowBuild = "37e0b33-20240617014909"; +const char* CanGrowBuild = "0354a7c-20240617022027"; diff --git a/Arduino/CanGrow/CanGrow_WebFunctions.h b/Arduino/CanGrow/CanGrow_WebFunctions.h index f35951a..82bbcc3 100644 --- a/Arduino/CanGrow/CanGrow_WebFunctions.h +++ b/Arduino/CanGrow/CanGrow_WebFunctions.h @@ -180,23 +180,17 @@ void SysRestart() { void SysWipe() { String body = returnHTMLheader(); - // TODO only debug and development solution, remove this later - if(webserver.hasArg("confirmed")) { - body += "

!! Wiping CanGrow's EEPROM !!


Device will restart in a few seconds.
After restart a new WiFi 'CanGrow-unconfigured' will be created. To access the WebUI visit http://192.168.4.20
"; - body += FPSTR(HTMLfooter); - webserver.send(200, "text/html", body); - wipeEEPROM(); - } else { - body += "

❗❗ Wiping EEPROM

"; - body += "
All settings will be removed!!
"; - body += "
Please confirm wiping the EEPROM"; - body += "
"; - body += "
"; - body += FPSTR(HTMLfooter); - webserver.send(200, "text/html", body); - } + body += "

❗❗ Wiping EEPROM

"; + body += "
All settings will be removed!!
"; + body += "
Please confirm wiping the EEPROM"; + body += "

Please confirm:
"; + body += "
"; + body += FPSTR(HTMLfooter); + webserver.send(200, "text/html", body); + } + void Sys404() { String body = returnHTMLheader(); body += "

❗ ️ 404 - not found

"; @@ -1032,6 +1026,21 @@ void POSTsetPumpManual() { webserver.send(302, "text/plain", "switch: success!\n"); } +void POSTwipeConfirm() { + String body = returnHTMLheader(); + // TODO only debug and development solution, remove this later + String confirm = webserver.arg("confirm"); + if(confirm == "on") { + body += "

!! Wiping CanGrow's EEPROM !!


Device will restart in a few seconds.
After restart a new WiFi 'CanGrow-unconfigured' will be created. To access the WebUI visit http://192.168.4.20
"; + body += FPSTR(HTMLfooter); + webserver.send(200, "text/html", body); + wipeEEPROM(); + } else { + webserver.send(400, "text/html", String("Error, 'confirm' missing nor wrong")); + } + +} + /* * API section @@ -1177,6 +1186,8 @@ void WebHandler() { webserver.on("/system/restart", HTTP_GET, SysRestart); // wipe eeprom triggered from WebGui webserver.on("/system/wipe", HTTP_GET, SysWipe); + // confirm wiping the device + webserver.on("/system/wipeConfirm", HTTP_POST, POSTwipeConfirm); // Maintenance mode webserver.on("/system/maintenance", HTTP_GET, SysMaintenance); // system update with binary