added initial support for hydroponic systems, changed cooldown to use minutes

This commit is contained in:
Empire
2021-10-22 17:39:42 +00:00
parent 0bcef25528
commit 49664ba6f7
7 changed files with 70 additions and 96 deletions
+13 -1
View File
@@ -61,6 +61,12 @@ public:
void activatePump(void);
bool isHydroponic(){
long current = this->mSetting->pSensorDry->get();
return !equalish(current,HYDROPONIC_MODE);
}
/**
* @brief Check if a plant is too dry and needs some water.
*
@@ -69,11 +75,17 @@ public:
*/
bool isPumpRequired()
{
if(isHydroponic()){
//hydroponic only uses timer based controll
return true;
}
bool isDry = getCurrentMoisture() > getSetting2Moisture();
bool isActive = isPumpTriggerActive();
return isDry && isActive;
}
bool isPumpTriggerActive()
{
long current = this->mSetting->pSensorDry->get();
@@ -110,7 +122,7 @@ public:
void init(void);
long getCooldownInSeconds() {
return this->mSetting->pPumpCooldownInHours->get()*60*60;
return this->mSetting->pPumpCooldownInMinutes->get()*60;
}
/**