firmware wip
This commit is contained in:
parent
8bc3e9ca62
commit
d5695f8926
1 changed files with 52 additions and 2 deletions
|
@ -95,6 +95,8 @@ bool UseFan;
|
|||
// In case the user uses no 12V LED on the LED output and an relais instead
|
||||
// we have to disable PWM. So we ask here for what kind of light user is going
|
||||
bool UseLEDrelais;
|
||||
// Which temperature sensor to use?
|
||||
byte TemperatureSensor_Type;
|
||||
|
||||
|
||||
|
||||
|
@ -703,6 +705,11 @@ bool loadEEPROM() {
|
|||
EEPROM.get(167, ntpOffset);
|
||||
// size is 1 byte
|
||||
EEPROM.get(169, UseLEDrelais);
|
||||
// size is 1 byte
|
||||
// I forgot to add TemperatureSensor_Type to EEPROM and noticed it
|
||||
// quite late in the process of programming. So this value residents
|
||||
// in 214 and not directly after UseLEDrelais
|
||||
EEPROM.get(214, TemperatureSensor_Type);
|
||||
}
|
||||
// TODO auth does not work atm
|
||||
// EEPROM.get(160, WebUiUsername);
|
||||
|
@ -1204,9 +1211,40 @@ void WEBroot() {
|
|||
} else {
|
||||
String body = FPSTR(HTMLheader);
|
||||
|
||||
body += "<h1>configured!</h1>";
|
||||
body += "<h1>🌱";
|
||||
body += GrowName;
|
||||
body += "</h1>";
|
||||
body += "<p>";
|
||||
body += timeClient.getFormattedTime();
|
||||
body += "Grow started: ";
|
||||
body += returnStrDateFromEpoch(GrowStart);
|
||||
body += "<br>";
|
||||
body += "Day of Grow: ";
|
||||
body += DayOfGrow;
|
||||
body += "<br><br>";
|
||||
body += "Soil Moisture: ";
|
||||
body += getSoilmoisture(MoistureSensor_Type);
|
||||
body += " %<br>";
|
||||
body += "Humidity: ";
|
||||
body += getHumidity();
|
||||
body += " ?<br>";
|
||||
body += "Temperature: ";
|
||||
body += getTemperature(TemperatureSensor_Type);
|
||||
body += " °C<br>";
|
||||
if(UsePump == true) {
|
||||
body += "Pump water level: ";
|
||||
switch(getWaterlevel()) {
|
||||
case 0:
|
||||
body += "OK";
|
||||
break;
|
||||
case 1:
|
||||
body += "Warning";
|
||||
break;
|
||||
case 2:
|
||||
body += "Critical";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
body += "</p>";
|
||||
body += returnHTMLfooter();
|
||||
|
||||
|
@ -1331,6 +1369,15 @@ void WEBsystemSettings() {
|
|||
body += SoilmoistureLow;
|
||||
body += "' required><br>\n";
|
||||
|
||||
// TemperatureSensor_Type byte
|
||||
body += "Temperature sensor type: <select id='TemperatureSensor_Type' name='TemperatureSensor_Type' required>\n";
|
||||
if(configured == false) {
|
||||
body += "<option disabled value='' selected hidden>---</option>\n";
|
||||
}
|
||||
body += "<option value='1'" + returnStrSelected(TemperatureSensor_Type, 1) + ">DHT11/22</option>\n";
|
||||
body += "<option value='2'" + returnStrSelected(TemperatureSensor_Type, 2) + ">I2C chirp</option>\n";
|
||||
body += "</select><br>\n";
|
||||
|
||||
// ntpOffset int
|
||||
body += "NTP offset: <input type='number' name='ntpOffset' min='0' value='";
|
||||
body += ntpOffset;
|
||||
|
@ -1518,6 +1565,7 @@ void POSTsystemSettings() {
|
|||
PumpOnTime = webserver.arg("PumpOnTime").toInt();
|
||||
UseFan = webserver.arg("UseFan").toInt();
|
||||
UseLEDrelais = webserver.arg("UseLEDrelais").toInt();
|
||||
TemperatureSensor_Type = webserver.arg("TemperatureSensor_Type").toInt();
|
||||
|
||||
configured = true;
|
||||
|
||||
|
@ -1537,6 +1585,8 @@ void POSTsystemSettings() {
|
|||
EEPROM.put(167, ntpOffset);
|
||||
// size is 1 byte
|
||||
EEPROM.put(169, UseLEDrelais);
|
||||
// size is 1 byte
|
||||
EEPROM.put(214, TemperatureSensor_Type);
|
||||
|
||||
EEPROM.commit();
|
||||
|
||||
|
|
Loading…
Reference in a new issue