firmware wip - begin to write pump watering stuff

This commit is contained in:
Marcus 2024-06-16 03:09:50 +02:00
parent a0f3db9a77
commit d6bd0f7638
5 changed files with 39 additions and 20 deletions

View file

@ -74,6 +74,9 @@ a:active {
width: 42px;
}
.helpbox {
font-size: 0.8em;
}
.nav {
background: #333;
width: 100%;

View file

@ -81,11 +81,11 @@ byte MoistureSensor_Type;
// SoilmoistureLow - contains the value , when soil moisture is assumed to be low,
byte SoilmoistureLow = 80;
// UsePump - is the pump used? bool
bool UsePump;
byte UsePump;
// UseFan - is the fan used? bool
// PumpOnTime in seconds
byte PumpOnTime = 3;
bool UseFan;
byte 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;
@ -94,12 +94,10 @@ bool UseFANrelais;
byte TemperatureSensor_Type;
unsigned short MaintenanceDuration = 300;
char Esp32CamIP[16];
// PumpInterval (int) in days
byte PumpInterval;
// PumpLastOn (long) timestamp
unsigned long PumpLastOn;
// PumpMode (short) 1: Pump on every n days, 2: Pump on when Soilmoisture <= SoilmoistureLow, 3: Both
byte PumpMode;
byte PumpMode = 1;
//
// Grow Stuff
@ -134,6 +132,10 @@ byte PinFANPWM = 255;
bool SunFade;
byte SunFadeDuration = 30;
// PumpIntervalVeg (int) in days
byte PumpIntervalVeg = 5;
byte PumpIntervalBloom = 3;
/*
*
* NTP

View file

@ -104,9 +104,9 @@ bool loadEEPROM() {
* 218 SunFadeDuration
* 219 MaintenanceDuration (2 byte)
* 221 Esp32CamIP (16 byte)
* 237 PumpInterval (1 byte)
* 238 PumpLastOn (4 byte)
* 242 PumpMode (1 byte)
* 237 PumpLastOn (4 byte)
* 241 PumpIntervalVeg (1 byte)
* 242 PumpIntervalVeg (1 byte)
* 243 ...
*
*/
@ -170,11 +170,9 @@ bool loadEEPROM() {
// size is 2 byte
EEPROM.get(219, MaintenanceDuration);
// size is 16 byte
EEPROM.get(237, Esp32CamIP);
// size is 1 byte
EEPROM.get(237, PumpInterval);
EEPROM.get(221, Esp32CamIP);
// size is 4 byte
EEPROM.get(238, PumpLastOn);
EEPROM.get(237, PumpLastOn);
// size is 1 byte
EEPROM.get(242, PumpMode);
}
@ -211,6 +209,8 @@ bool loadEEPROM() {
EEPROM.get(216, PinFANPWM);
EEPROM.get(217, SunFade);
EEPROM.get(218, SunFadeDuration);
// size is 1 byte
EEPROM.get(237, PumpIntervalVeg);
}

View file

@ -1,5 +1,5 @@
/* CanGrow_Version.h gets generated from cangrow.sh */
const char* CanGrowVer = "0.1-dev";
const char* CanGrowBuild = "064db73";
const char* CanGrowBuild = "a0f3db9";

View file

@ -551,19 +551,32 @@ void WEBsystemSettings() {
body += "<form method='post' action='/systemSettings/save'>\n";
// UseFan bool
body += "Use FAN: <select id='UseFan' name='UseFan' required>\n";
body += "Fan mode: <select id='UseFan' name='UseFan' required>\n";
if(configured == false){body += "<option disabled value='' selected hidden>---</option>\n";}
body += "<option value='1'" + returnStrSelected(UseFan, 1) + ">Yes</option>\n";
body += "<option value='0'" + returnStrSelected(UseFan, 0) + ">No</option>\n";
body += "<option value='1'" + returnStrSelected(UseFan, 0) + ">Off</option>\n";
body += "<option value='1'" + returnStrSelected(UseFan, 1) + ">Use</option>\n";
body += "<option value='0'" + returnStrSelected(UseFan, 2) + ">Do not use</option>\n";
body += "</select><br>\n";
/*
// UsePump bool
body += "Use PUMP: <select id='UsePump' name='UsePump' required>\n";
if(configured == false){body += "<option disabled value='' selected hidden>---</option>\n";}
body += "<option value='1'" + returnStrSelected(UsePump, 1) + ">Yes</option>\n";
body += "<option value='0'" + returnStrSelected(UsePump, 0) + ">No</option>\n";
body += "</select><br>\n";
*/
// PumpMode byte
body += "Pump mode: <select id='UsePump' name='UsePump' required>\n";
if(configured == false){body += "<option disabled value='' selected hidden>---</option>\n";}
body += "<option value='1'" + returnStrSelected(UsePump, 0) + ">Off</option>\n";
body += "<option value='1'" + returnStrSelected(UsePump, 1) + ">1</option>\n";
body += "<option value='1'" + returnStrSelected(UsePump, 2) + ">2</option>\n";
body += "<option value='0'" + returnStrSelected(UsePump, 3) + ">3</option>\n";
body += "</select><br><p class='helpbox'><b>1:</b> Water every few days.<br> \
<b>2:</b> Water if the soil moisture falls below <i>Soilmoisture low</i> value<br> \
<b>3:</b> Water every few days if the soil moisture falls below <i>Soilmoisture low</i> value.</p>\n";
// UseLEDrelais bool
body += "Use relais for LED: <select id='UseLEDrelais' name='UseLEDrelais' required>\n";
if(configured == false){body += "<option disabled value='' selected hidden>---</option>\n";}
@ -583,7 +596,8 @@ void WEBsystemSettings() {
body += "PUMP ON time: <input class='inputShort' type='number' name='PumpOnTime' min='0' max='255' value='";
body += PumpOnTime;
body += "' required> Seconds<br>\n";
// MoistureSensor_Type byte
body += "Soilmoisture sensor: <select id='MoistureSensor_Type' name='MoistureSensor_Type' required>\n";
if(configured == false) {
@ -812,7 +826,7 @@ void POSTsystemSettings() {
TemperatureSensor_Type = webserver.arg("TemperatureSensor_Type").toInt();
MaintenanceDuration = webserver.arg("MaintenanceDuration").toInt();
String Esp32CamIP_tmp = webserver.arg("Esp32CamIP");
Esp32CamIP_tmp.toCharArray(Esp32CamIP, 221);
Esp32CamIP_tmp.toCharArray(Esp32CamIP, 221);
configured = true;