some fixes for hydroponics mode
This commit is contained in:
parent
49664ba6f7
commit
9170a1fe05
@ -82,10 +82,10 @@
|
|||||||
/** \addtogroup Configuration
|
/** \addtogroup Configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define FIRMWARE_VERSION "sw 1.4 hw 0.10"
|
#define FIRMWARE_VERSION "sw 2.0 hw 0.10_no_sensor_caps"
|
||||||
|
|
||||||
#define TIMED_LIGHT_PIN CUSTOM1_PIN5
|
#define TIMED_LIGHT_PIN CUSTOM1_PIN5
|
||||||
#define FLOWMETER_PIN CUSTOM1_PIN1
|
//#define FLOWMETER_PIN CUSTOM1_PIN1
|
||||||
#ifdef FLOWMETER_PIN
|
#ifdef FLOWMETER_PIN
|
||||||
#define FLOWMETER_FLOWFACTOR 22 /** F = 22 * Q;Q = L/min */
|
#define FLOWMETER_FLOWFACTOR 22 /** F = 22 * Q;Q = L/min */
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#define LOG_LEVEL_INFO 2
|
#define LOG_LEVEL_INFO 2
|
||||||
#define LOG_LEVEL_DEBUG 3
|
#define LOG_LEVEL_DEBUG 3
|
||||||
|
|
||||||
|
|
||||||
#define LOG_TANKSENSOR_FAIL_DETECT "Failed to detect and initialize distance sensor!"
|
#define LOG_TANKSENSOR_FAIL_DETECT "Failed to detect and initialize distance sensor!"
|
||||||
#define LOG_TANKSENSOR_FAIL_DETECT_CODE -1
|
#define LOG_TANKSENSOR_FAIL_DETECT_CODE -1
|
||||||
|
|
||||||
@ -25,7 +26,7 @@
|
|||||||
|
|
||||||
//msg is dynamic defined
|
//msg is dynamic defined
|
||||||
#define LOG_PUMP_INEFFECTIVE -4
|
#define LOG_PUMP_INEFFECTIVE -4
|
||||||
|
#define LOG_PUMP_STARTED_CODE 10
|
||||||
#define LOG_DEBUG_CODE 1001
|
#define LOG_DEBUG_CODE 1001
|
||||||
#define LOG_SLEEP_NIGHT 100
|
#define LOG_SLEEP_NIGHT 100
|
||||||
#define LOG_SLEEP_DAY 101
|
#define LOG_SLEEP_DAY 101
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
|
|
||||||
bool isHydroponic(){
|
bool isHydroponic(){
|
||||||
long current = this->mSetting->pSensorDry->get();
|
long current = this->mSetting->pSensorDry->get();
|
||||||
return !equalish(current,HYDROPONIC_MODE);
|
return equalish(current,HYDROPONIC_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,9 +82,7 @@ public:
|
|||||||
bool isDry = getCurrentMoisture() > getSetting2Moisture();
|
bool isDry = getCurrentMoisture() > getSetting2Moisture();
|
||||||
bool isActive = isPumpTriggerActive();
|
bool isActive = isPumpTriggerActive();
|
||||||
return isDry && isActive;
|
return isDry && isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool isPumpTriggerActive()
|
bool isPumpTriggerActive()
|
||||||
{
|
{
|
||||||
|
@ -34,8 +34,8 @@ void Plant::init(void)
|
|||||||
{
|
{
|
||||||
/* Initialize Home Settings validator */
|
/* Initialize Home Settings validator */
|
||||||
this->mSetting->pSensorDry->setDefaultValue(DEACTIVATED_PLANT);
|
this->mSetting->pSensorDry->setDefaultValue(DEACTIVATED_PLANT);
|
||||||
this->mSetting->pSensorDry->setValidator([](double candidate) {
|
this->mSetting->pSensorDry->setValidator([](long candidate) {
|
||||||
return (((candidate >= 0.0) && (candidate <= 100.0)) || equalish(candidate,DEACTIVATED_PLANT));
|
return (((candidate >= 0.0) && (candidate <= 100.0)) || equalish(candidate,DEACTIVATED_PLANT) || equalish(candidate,HYDROPONIC_MODE));
|
||||||
});
|
});
|
||||||
this->mSetting->pPumpAllowedHourRangeStart->setDefaultValue(8); // start at 8:00
|
this->mSetting->pPumpAllowedHourRangeStart->setDefaultValue(8); // start at 8:00
|
||||||
this->mSetting->pPumpAllowedHourRangeStart->setValidator([](long candidate) {
|
this->mSetting->pPumpAllowedHourRangeStart->setValidator([](long candidate) {
|
||||||
|
@ -432,6 +432,7 @@ int determineNextPump(bool isLowLight)
|
|||||||
|
|
||||||
log(LOG_LEVEL_DEBUG, String(String(i) + " Requested pumping"), LOG_DEBUG_CODE);
|
log(LOG_LEVEL_DEBUG, String(String(i) + " Requested pumping"), LOG_DEBUG_CODE);
|
||||||
pumpToUse = i;
|
pumpToUse = i;
|
||||||
|
return pumpToUse;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -454,7 +455,7 @@ int determineNextPump(bool isLowLight)
|
|||||||
consecutiveWateringPlant[i] = 0;
|
consecutiveWateringPlant[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pumpToUse;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -573,6 +574,7 @@ void pumpActiveLoop()
|
|||||||
|
|
||||||
if (!pumpStarted)
|
if (!pumpStarted)
|
||||||
{
|
{
|
||||||
|
log(LOG_LEVEL_INFO, "Starting pump " + String(pumpToRun) , LOG_PUMP_STARTED_CODE );
|
||||||
initPumpLogic();
|
initPumpLogic();
|
||||||
pumpStarted = true;
|
pumpStarted = true;
|
||||||
}
|
}
|
||||||
@ -601,7 +603,7 @@ void pumpActiveLoop()
|
|||||||
mPlants[pumpToRun].setProperty("waterusage").send(String(pumped));
|
mPlants[pumpToRun].setProperty("waterusage").send(String(pumped));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (millis() > pumpTarget)
|
if (millis() > pumpTarget*1000)
|
||||||
{
|
{
|
||||||
targetReached = true;
|
targetReached = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user