firmware wip - add configurable soilmoisture wet and dry values

This commit is contained in:
DeltaLima 2024-12-05 03:16:25 +01:00
parent c17819155f
commit 65e6989a5d
5 changed files with 36 additions and 4 deletions

View file

@ -76,6 +76,9 @@ a:active {
.helpbox { .helpbox {
font-size: 0.8em; font-size: 0.8em;
margin-left: 15px;
margin-top: 5px;
margin-bottom: 5px;
} }
.nav { .nav {
background: #333; background: #333;

View file

@ -110,6 +110,8 @@ char Esp32CamIP[16];
// PumpLastOn (long) timestamp // PumpLastOn (long) timestamp
unsigned long PumpLastOn; unsigned long PumpLastOn;
bool OutputInvert; bool OutputInvert;
byte SoilmoistureWet;
byte SoilmoistureDry;

View file

@ -108,7 +108,9 @@ bool loadEEPROM() {
* 241 PumpIntervalVeg (1 byte) * 241 PumpIntervalVeg (1 byte)
* 242 PumpIntervalBloom (1 byte) * 242 PumpIntervalBloom (1 byte)
* 243 OutputInvert (1 byte) * 243 OutputInvert (1 byte)
* 244 ... * 244 SoilmoistureWet (1 byte)
* 245 SoilmoistureDry (1 byte)
* 246 ...
* *
*/ */
@ -176,7 +178,10 @@ bool loadEEPROM() {
EEPROM.get(237, PumpLastOn); EEPROM.get(237, PumpLastOn);
// size is 1 byte // size is 1 byte
EEPROM.get(243, OutputInvert); EEPROM.get(243, OutputInvert);
// size is 1 byte
EEPROM.get(244, SoilmoistureWet);
// size is 1 byte
EEPROM.get(245, SoilmoistureDry);
} }
// TODO auth does not work atm // TODO auth does not work atm
// EEPROM.get(160, WebUiUsername); // EEPROM.get(160, WebUiUsername);
@ -257,6 +262,10 @@ bool loadEEPROM() {
Serial.println(PumpLastOn); Serial.println(PumpLastOn);
Serial.print("OutputInvert: "); Serial.print("OutputInvert: ");
Serial.println(OutputInvert); Serial.println(OutputInvert);
Serial.print("SoilmoistureWet: ");
Serial.println(SoilmoistureWet);
Serial.print("SoilmoistureDry: ");
Serial.println(SoilmoistureDry);
Serial.println("---- Grow values ----"); Serial.println("---- Grow values ----");
Serial.print("GrowName: "); Serial.print("GrowName: ");

View file

@ -1,5 +1,5 @@
/* CanGrow_Version.h gets generated from cangrow.sh */ /* CanGrow_Version.h gets generated from cangrow.sh */
const char* CanGrowVer = "0.1-dev"; const char* CanGrowVer = "0.1-dev";
const char* CanGrowBuild = "3c14910-20241205024405"; const char* CanGrowBuild = "c178191-20241205031352";

View file

@ -639,6 +639,20 @@ void WEBsystemSettings() {
body += SoilmoistureLow; body += SoilmoistureLow;
body += "' required> %<br>\n"; body += "' required> %<br>\n";
// SoilmoistureWet byte
body += "Soilmoisture wet: <input class='inputShort' type='number' name='SoilmoistureWet' min='0' value='";
body += SoilmoistureWet;
body += "' required>\n";
body += "<p class='helpbox'><b>Analog capacitive:</b> <i>160</i><br> \
<b>I2C Chirp:</b> <i>485</i></p>";
// SoilmoistureDry byte
body += "Soilmoisture dry: <input class='inputShort' type='number' name='SoilmoistureDry' min='0' value='";
body += SoilmoistureDry;
body += "' required>\n";
body += "<p class='helpbox'><b>Analog capacitive:</b> <i>360</i><br> \
<b>I2C Chirp:</b> <i>250</i></p>";
// TemperatureSensor_Type byte // TemperatureSensor_Type byte
body += "Temperature sensor: <select id='TemperatureSensor_Type' name='TemperatureSensor_Type' required>\n"; body += "Temperature sensor: <select id='TemperatureSensor_Type' name='TemperatureSensor_Type' required>\n";
if(configured == false) { if(configured == false) {
@ -847,6 +861,8 @@ void POSTsystemSettings() {
String Esp32CamIP_tmp = webserver.arg("Esp32CamIP"); String Esp32CamIP_tmp = webserver.arg("Esp32CamIP");
Esp32CamIP_tmp.toCharArray(Esp32CamIP, 221); Esp32CamIP_tmp.toCharArray(Esp32CamIP, 221);
OutputInvert = webserver.arg("OutputInvert").toInt(); OutputInvert = webserver.arg("OutputInvert").toInt();
SoilmoistureWet = webserver.arg("SoilmoistureWet").toInt();
SoilmoistureDry = webserver.arg("SoilmoistureDry").toInt();
configured = true; configured = true;
@ -873,6 +889,8 @@ void POSTsystemSettings() {
EEPROM.put(219, MaintenanceDuration); EEPROM.put(219, MaintenanceDuration);
EEPROM.put(221, Esp32CamIP); EEPROM.put(221, Esp32CamIP);
EEPROM.put(243, OutputInvert); EEPROM.put(243, OutputInvert);
EEPROM.put(244, SoilmoistureWet);
EEPROM.put(245, SoilmoistureDry);
// write data to EEPROM // write data to EEPROM
EEPROM.commit(); EEPROM.commit();