From d6bd0f76386368ab9f0278ef8416ae43eb8e5e6a Mon Sep 17 00:00:00 2001 From: Marcus Date: Sun, 16 Jun 2024 03:09:50 +0200 Subject: [PATCH] firmware wip - begin to write pump watering stuff --- Arduino/CanGrow/CanGrow_HTML.h | 3 +++ Arduino/CanGrow/CanGrow_Init.h | 12 ++++++----- Arduino/CanGrow/CanGrow_SysFunctions.h | 14 ++++++------- Arduino/CanGrow/CanGrow_Version.h | 2 +- Arduino/CanGrow/CanGrow_WebFunctions.h | 28 +++++++++++++++++++------- 5 files changed, 39 insertions(+), 20 deletions(-) diff --git a/Arduino/CanGrow/CanGrow_HTML.h b/Arduino/CanGrow/CanGrow_HTML.h index 3837813..daa8db5 100644 --- a/Arduino/CanGrow/CanGrow_HTML.h +++ b/Arduino/CanGrow/CanGrow_HTML.h @@ -74,6 +74,9 @@ a:active { width: 42px; } +.helpbox { + font-size: 0.8em; +} .nav { background: #333; width: 100%; diff --git a/Arduino/CanGrow/CanGrow_Init.h b/Arduino/CanGrow/CanGrow_Init.h index 590a966..f862724 100644 --- a/Arduino/CanGrow/CanGrow_Init.h +++ b/Arduino/CanGrow/CanGrow_Init.h @@ -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 diff --git a/Arduino/CanGrow/CanGrow_SysFunctions.h b/Arduino/CanGrow/CanGrow_SysFunctions.h index 7978df4..f4ae1d5 100644 --- a/Arduino/CanGrow/CanGrow_SysFunctions.h +++ b/Arduino/CanGrow/CanGrow_SysFunctions.h @@ -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); } diff --git a/Arduino/CanGrow/CanGrow_Version.h b/Arduino/CanGrow/CanGrow_Version.h index d0aab83..0f3937a 100644 --- a/Arduino/CanGrow/CanGrow_Version.h +++ b/Arduino/CanGrow/CanGrow_Version.h @@ -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"; diff --git a/Arduino/CanGrow/CanGrow_WebFunctions.h b/Arduino/CanGrow/CanGrow_WebFunctions.h index b2737a3..6054d52 100644 --- a/Arduino/CanGrow/CanGrow_WebFunctions.h +++ b/Arduino/CanGrow/CanGrow_WebFunctions.h @@ -551,19 +551,32 @@ void WEBsystemSettings() { body += "
\n"; // UseFan bool - body += "Use FAN: \n"; if(configured == false){body += "\n";} - body += "\n"; - body += "\n"; + body += "\n"; + body += "\n"; + body += "\n"; body += "
\n"; - + +/* // UsePump bool body += "Use PUMP:
\n"; - +*/ + // PumpMode byte + body += "Pump mode:

1: Water every few days.
\ +2: Water if the soil moisture falls below Soilmoisture low value
\ +3: Water every few days if the soil moisture falls below Soilmoisture low value.

\n"; + // UseLEDrelais bool body += "Use relais for LED: Seconds
\n"; - + + // MoistureSensor_Type byte body += "Soilmoisture sensor: