firmware wip - add basic maintenance mode, which dimms the led for a minute
This commit is contained in:
parent
d879b209bd
commit
12fdd869c4
2 changed files with 47 additions and 5 deletions
|
@ -71,6 +71,10 @@ byte ScreenToDisplay = 0;
|
||||||
byte DisplayScreenDuration = 3;
|
byte DisplayScreenDuration = 3;
|
||||||
// how many seconds actual screen got displayed
|
// how many seconds actual screen got displayed
|
||||||
byte ScreenIterationPassed = 0;
|
byte ScreenIterationPassed = 0;
|
||||||
|
|
||||||
|
bool MaintenanceMode = false;
|
||||||
|
unsigned long MaintenanceStarted = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* EEPROM saved variables
|
* EEPROM saved variables
|
||||||
|
@ -117,6 +121,7 @@ bool UseLEDrelais;
|
||||||
bool UseFANrelais;
|
bool UseFANrelais;
|
||||||
// Which temperature sensor to use?
|
// Which temperature sensor to use?
|
||||||
byte TemperatureSensor_Type;
|
byte TemperatureSensor_Type;
|
||||||
|
unsigned short MaintenanceDuration = 60000;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Grow Stuff
|
// Grow Stuff
|
||||||
|
@ -1568,7 +1573,18 @@ void loop() {
|
||||||
// when DayOfGrow is larger then DaysVeg we must be in Bloom
|
// when DayOfGrow is larger then DaysVeg we must be in Bloom
|
||||||
|
|
||||||
// set the actual state of the Grow LED
|
// set the actual state of the Grow LED
|
||||||
|
// when being in Maintenance Mode and UseRelaisLED not true,
|
||||||
|
// dimm the light
|
||||||
|
if(MaintenanceMode == true) {
|
||||||
|
if((currentRuntime - MaintenanceStarted <= MaintenanceDuration) && (UseLEDrelais == false)) {
|
||||||
|
// in case of being in Maintenance Mode , dimm the grow light when not a relais is used
|
||||||
|
setOutput(1, 20);
|
||||||
|
} else {
|
||||||
|
MaintenanceMode = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
controlLED();
|
controlLED();
|
||||||
|
}
|
||||||
displayScreens();
|
displayScreens();
|
||||||
|
|
||||||
// current time gets previous time for new interval
|
// current time gets previous time for new interval
|
||||||
|
@ -1720,6 +1736,11 @@ String returnHTMLheader(String MenuEntry = "") {
|
||||||
header += CanGrowVer;
|
header += CanGrowVer;
|
||||||
header += "</a></li>\n";
|
header += "</a></li>\n";
|
||||||
|
|
||||||
|
if(MaintenanceMode == true) {
|
||||||
|
// status icons
|
||||||
|
header += "<li><span>🇲</span></li>\n";
|
||||||
|
}
|
||||||
|
|
||||||
// close <ul> and start <div>
|
// close <ul> and start <div>
|
||||||
header += "</ul><div class='center'>";
|
header += "</ul><div class='center'>";
|
||||||
|
|
||||||
|
@ -1961,20 +1982,25 @@ void WEBroot() {
|
||||||
body += ((PinLEDPWM * 100) / 255);
|
body += ((PinLEDPWM * 100) / 255);
|
||||||
body += " %<br>\n";
|
body += " %<br>\n";
|
||||||
body += "<form method='post' action='/switch'>\n";
|
body += "<form method='post' action='/switch'>\n";
|
||||||
body += "MOSFET<select id='output' name='output' required>\n";
|
body += "MOSFET<select id='output' name='output' >\n";
|
||||||
body += "<option disabled value='' selected hidden>---</option>\n";
|
body += "<option disabled value='' selected hidden>---</option>\n";
|
||||||
body += "<option value='1'>LED</option>\n";
|
body += "<option value='1'>LED</option>\n";
|
||||||
body += "<option value='2'>FAN</option>\n";
|
body += "<option value='2'>FAN</option>\n";
|
||||||
body += "<option value='3'>PUMP</option>\n";
|
body += "<option value='3'>PUMP</option>\n";
|
||||||
body += "</select><br>";
|
body += "</select><br>";
|
||||||
|
|
||||||
body += "On/Off: <select id='state' name='state' required>\n";
|
body += "On/Off: <select id='state' name='state' >\n";
|
||||||
body += "<option disabled value='' selected hidden>---</option>\n";
|
body += "<option disabled value='' selected hidden>---</option>\n";
|
||||||
body += "<option value='1'>On</option>\n";
|
body += "<option value='1'>On</option>\n";
|
||||||
body += "<option value='0'>Off</option>\n";
|
body += "<option value='0'>Off</option>\n";
|
||||||
body += "</select><br>\n";
|
body += "</select><br>\n";
|
||||||
|
|
||||||
body += "Intensity: <input type='range' id='OutputPWM' name='OutputPWM' min='1' max='255' value='255'/><br>\n";
|
body += "Intensity: <input type='range' id='OutputPWM' name='OutputPWM' min='1' max='255' value='255'/><br>\n";
|
||||||
|
body += "Maintenance: <select id='EnableMaintenance' name='EnableMaintenance'>\n";
|
||||||
|
body += "<option disabled value='' selected hidden>---</option>\n";
|
||||||
|
body += "<option value='1'>On</option>\n";
|
||||||
|
body += "<option value='0'>Off</option>\n";
|
||||||
|
body += "</select><br>\n";
|
||||||
|
|
||||||
body += "<input type='submit' value='Save'>\n";
|
body += "<input type='submit' value='Save'>\n";
|
||||||
body += "</form>";
|
body += "</form>";
|
||||||
|
@ -2516,12 +2542,15 @@ void POSTsetOutput() {
|
||||||
byte OutputNr = webserver.arg("output").toInt();
|
byte OutputNr = webserver.arg("output").toInt();
|
||||||
//PinLEDPWM = webserver.arg("PinLEDPWM").toInt();
|
//PinLEDPWM = webserver.arg("PinLEDPWM").toInt();
|
||||||
byte OutputPWM = webserver.arg("OutputPWM").toInt();
|
byte OutputPWM = webserver.arg("OutputPWM").toInt();
|
||||||
|
byte EnableMaintenance = webserver.arg("EnableMaintenance").toInt();
|
||||||
|
|
||||||
Serial.println(":: POSTsetOutput ::");
|
Serial.println(":: POSTsetOutput ::");
|
||||||
Serial.print("OutputState: ");
|
Serial.print("OutputState: ");
|
||||||
Serial.println(OutputState);
|
Serial.println(OutputState);
|
||||||
Serial.print("OutputNr: ");
|
Serial.print("OutputNr: ");
|
||||||
Serial.println(OutputNr);
|
Serial.println(OutputNr);
|
||||||
|
Serial.print("EnableMaintenance: ");
|
||||||
|
Serial.println(EnableMaintenance);
|
||||||
|
|
||||||
if((OutputNr > 3) || (OutputNr < 1) || (OutputState > 255) || (OutputState < 0)) {
|
if((OutputNr > 3) || (OutputNr < 1) || (OutputState > 255) || (OutputState < 0)) {
|
||||||
webserver.send(400, "text/plain", "not valid\n");
|
webserver.send(400, "text/plain", "not valid\n");
|
||||||
|
@ -2533,9 +2562,18 @@ void POSTsetOutput() {
|
||||||
setOutput(OutputNr, 0);
|
setOutput(OutputNr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
webserver.sendHeader("Location", String("/?success"), true);
|
webserver.sendHeader("Location", String("/?success"), true);
|
||||||
webserver.send(302, "text/plain", "switch: success!\n");
|
webserver.send(302, "text/plain", "switch: success!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(EnableMaintenance > 0 ) {
|
||||||
|
MaintenanceMode = true;
|
||||||
|
MaintenanceStarted = millis();
|
||||||
|
} else {
|
||||||
|
MaintenanceMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -103,8 +103,12 @@ a:active {
|
||||||
<li><a href='/wifiSettings' >📡 WiFi settings</a></li>
|
<li><a href='/wifiSettings' >📡 WiFi settings</a></li>
|
||||||
<li><a href='/help' >❓ Help</a></li>
|
<li><a href='/help' >❓ Help</a></li>
|
||||||
<li><span class='MenuTime'>23:57:31</span></li>
|
<li><span class='MenuTime'>23:57:31</span></li>
|
||||||
|
<li><span>Ⓜ️</span></li>
|
||||||
<li><a href='https://git.la10cy.net/DeltaLima/CanGrow' target='_blank'>CanGrow v0.1</a></li>
|
<li><a href='https://git.la10cy.net/DeltaLima/CanGrow' target='_blank'>CanGrow v0.1</a></li>
|
||||||
</ul><div class='center'><h2>🌱 Ruderalis Indica</h2>
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class='center'><h2>🌱 Ruderalis Indica</h2>
|
||||||
|
|
||||||
|
|
||||||
<div class='gaugeWrapper'>
|
<div class='gaugeWrapper'>
|
||||||
|
|
Loading…
Reference in a new issue