firmware - add manual pump trigger, fix missing eeprom commit in controlPump

This commit is contained in:
DeltaLima 2024-12-09 03:43:44 +01:00
parent b63fc08d29
commit f920d6509d
2 changed files with 24 additions and 8 deletions

View file

@ -731,6 +731,7 @@ void controlPUMP() {
setOutput(3, 0); setOutput(3, 0);
//digitalWrite(PinPUMP, LOW); //digitalWrite(PinPUMP, LOW);
EEPROM.put(237, PumpLastOn); EEPROM.put(237, PumpLastOn);
EEPROM.commit(); //write to EEPROM
PumpOnTimePassed = 0; PumpOnTimePassed = 0;
} }
// otherwise check which PumpMode to use // otherwise check which PumpMode to use
@ -796,6 +797,7 @@ void controlPUMP() {
//digitalWrite(PinPUMP, LOW); //digitalWrite(PinPUMP, LOW);
PumpLastOn = timeClient.getEpochTime(); PumpLastOn = timeClient.getEpochTime();
EEPROM.put(237, PumpLastOn); EEPROM.put(237, PumpLastOn);
EEPROM.commit(); //write to EEPROM
PumpOnTimePassed = 0; PumpOnTimePassed = 0;
} }
// when valSoilmoistureAvg is greater then the Low value, // when valSoilmoistureAvg is greater then the Low value,

View file

@ -210,20 +210,32 @@ void Syslogout() {
void SysMaintenance() { void SysMaintenance() {
String body = returnHTMLheader(); String body = returnHTMLheader();
if( (webserver.hasArg("on")) ) { if( (webserver.hasArg("DimmOn")) ) {
MaintenanceMode = true; MaintenanceMode = true;
MaintenanceStarted = millis(); MaintenanceStarted = millis();
body += "<div class='infomsg'>&#9208;&#65039; On for "; body += "<div class='infomsg'>&#9208;&#65039; Dimm LED On for ";
body += MaintenanceDuration; body += MaintenanceDuration;
body += "s</div>"; body += "s</div>";
} else if (webserver.hasArg("off")){ } else if (webserver.hasArg("DimmOff")){
MaintenanceMode = false; MaintenanceMode = false;
body += "<div class='infomsg'>&#9208;&#65039; Off</div>"; body += "<div class='infomsg'>&#9208;&#65039; Dimm LED Off</div>";
} else if(webserver.hasArg("PumpOnManual")) {
PumpOnManual = true;
body += "<div class='infomsg'>&#x1F4A7; Pump manual activated for ";
body += PumpOnTime;
body += "s</div>";
} }
body += "<h2>&#9208;&#65039; Maintenance Mode</h2>"; body += "<h2>&#x1f9f0; Maintenance</h2>";
body += "<a class='button' href='/system/maintenance?on=1'>On</a>&nbsp;&nbsp;<a class='button' href='/system/maintenance?off=1'>Off</a>";
body += "Dimm LED <a class='button' href='/system/maintenance?DimmOn=1'>On</a>&nbsp;&nbsp;<a class='button' href='/system/maintenance?DimmOff=1'>Off</a><br><br><br>";
body += "Pump manual <a class='button' href='/system/maintenance?PumpOnManual=1'>Activate for ";
body += PumpOnTime;
body += "s</a><br>";
body += FPSTR(HTMLfooter); body += FPSTR(HTMLfooter);
webserver.send(200, "text/html", body); webserver.send(200, "text/html", body);
@ -379,11 +391,13 @@ void WEBroot() {
body += "<span style='color: red;'>Critical</span>"; body += "<span style='color: red;'>Critical</span>";
break; break;
} }
body += "<br>\n";
} }
body += "<br>\n";
body += "<b>Growlight brightness:</b> "; body += "<b>Growlight brightness:</b> ";
body += ((PinLEDPWM * 100) / 255); body += ((PinLEDPWM * 100) / 255);
body += " %<br>\n"; body += " %<br>\n";
body += "<br>\n";
//~ body += "<form method='post' action='/switch'>\n"; //~ body += "<form method='post' action='/switch'>\n";
//~ body += "<b>MOSFET:</b> <select id='output' name='output' >\n"; //~ body += "<b>MOSFET:</b> <select id='output' name='output' >\n";
//~ body += "<option disabled value='' selected hidden>---</option>\n"; //~ body += "<option disabled value='' selected hidden>---</option>\n";
@ -402,7 +416,7 @@ void WEBroot() {
//~ body += "<input type='submit' value='Save'>\n"; //~ body += "<input type='submit' value='Save'>\n";
//~ body += "</form><br>\n"; //~ body += "</form><br>\n";
body += "<a class='button' href='/system/maintenance'>Maintenance Mode</a>"; body += "<a class='button' href='/system/maintenance'>&#x1f9f0; Maintenance</a>";
body += FPSTR(HTMLfooter); body += FPSTR(HTMLfooter);