diff --git a/Arduino/CanGrow/CanGrow.ino b/Arduino/CanGrow/CanGrow.ino
index 37659fd..d0e0105 100644
--- a/Arduino/CanGrow/CanGrow.ino
+++ b/Arduino/CanGrow/CanGrow.ino
@@ -1657,6 +1657,8 @@ void WebHandler() {
webserver.on("/system/restart", HTTP_GET, SysRestart);
// wipe eeprom triggered from WebGui
webserver.on("/system/wipe", HTTP_GET, SysWipe);
+ // Maintenance mode
+ webserver.on("/system/maintenance", HTTP_GET, SysMaintenance);
// does not work atm TODO
//webserver.on("/logout", [](){ webserver.send(401, "text/html", "logged out!"); });
@@ -1750,7 +1752,7 @@ String returnHTMLheader(String MenuEntry = "") {
// status icons and info
if(MaintenanceMode == true) {
// status icons
- header += " | 🇲 ";
+ header += " | ⏸️ ";
header += MaintenanceDuration - ((millis() - MaintenanceStarted) / 1000);
header += "s";
}
@@ -1885,6 +1887,28 @@ void Syslogout() {
webserver.send(401, "text/html", body);
}
+void SysMaintenance() {
+ String body = returnHTMLheader();
+
+ if( (webserver.hasArg("on")) ) {
+ MaintenanceMode = true;
+ MaintenanceStarted = millis();
+ body += "
⏸️ On for ";
+ body += MaintenanceDuration;
+ body += "s
";
+ } else if (webserver.hasArg("off")){
+ MaintenanceMode = false;
+ body += "⏸️ Off
";
+ }
+
+
+ body += "⏸️ Maintenance Mode
";
+ body += "";
+ body += "";
+
+ body += FPSTR(HTMLfooter);
+ webserver.send(200, "text/html", body);
+}
/*
* TODO
@@ -2017,14 +2041,10 @@ void WEBroot() {
body += "
\n";
body += "Intensity:
\n";
- body += "Maintenance:
\n";
body += "\n";
- body += "";
+ body += "
\n";
+ body += "";
body += FPSTR(HTMLfooter);
@@ -2571,15 +2591,12 @@ void POSTsetOutput() {
byte OutputNr = webserver.arg("output").toInt();
//PinLEDPWM = webserver.arg("PinLEDPWM").toInt();
byte OutputPWM = webserver.arg("OutputPWM").toInt();
- byte EnableMaintenance = webserver.arg("EnableMaintenance").toInt();
Serial.println(":: POSTsetOutput ::");
Serial.print("OutputState: ");
Serial.println(OutputState);
Serial.print("OutputNr: ");
Serial.println(OutputNr);
- Serial.print("EnableMaintenance: ");
- Serial.println(EnableMaintenance);
if((OutputNr > 3) || (OutputNr < 1) || (OutputState > 255) || (OutputState < 0)) {
webserver.send(400, "text/plain", "not valid\n");
@@ -2595,14 +2612,7 @@ void POSTsetOutput() {
webserver.sendHeader("Location", String("/?success"), true);
webserver.send(302, "text/plain", "switch: success!\n");
}
-
- if((EnableMaintenance > 0) && (UseLEDrelais == false)) {
- MaintenanceMode = true;
- MaintenanceStarted = millis();
- } else {
- MaintenanceMode = false;
- }
-
+
}