basic pump ml calculation
This commit is contained in:
parent
61fad8e14c
commit
d69feb4143
@ -51,10 +51,14 @@ void Plant::init(void)
|
||||
return (candidate >= 0);
|
||||
});
|
||||
|
||||
this->mSetting->pPumpDuration->setDefaultValue(5);
|
||||
this->mSetting->pPumpDuration->setDefaultValue(30);
|
||||
this->mSetting->pPumpDuration->setValidator([](long candidate) {
|
||||
return ((candidate >= 0) && (candidate <= 1000));
|
||||
});
|
||||
this->mSetting->pPumpMl->setDefaultValue(0);
|
||||
this->mSetting->pPumpMl->setValidator([](long candidate) {
|
||||
return ((candidate >= 0) && (candidate <= 5000));
|
||||
});
|
||||
this->mSetting->pPumpPowerLevel->setDefaultValue(100);
|
||||
this->mSetting->pPumpPowerLevel->setValidator([](long candidate) {
|
||||
return ((candidate >= 0) && (candidate <= 100));
|
||||
|
@ -601,6 +601,7 @@ void pumpActiveLoop()
|
||||
}
|
||||
|
||||
#ifdef FLOWMETER_PIN
|
||||
|
||||
int16_t pulses;
|
||||
pcnt_unit_t unit = (pcnt_unit_t)(PCNT_UNIT_7);
|
||||
esp_err_t result = pcnt_get_counter_value(unit, &pulses);
|
||||
@ -627,8 +628,10 @@ void pumpActiveLoop()
|
||||
mPlants[pumpToRun].setProperty("waterusage").send(String(pumped));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
long duration = pumpTarget - millis();
|
||||
long pumpStarted = pumpTarget - (mPlants[pumpToRun].getPumpDuration() * 1000);
|
||||
long duration = millis()-pumpStarted;
|
||||
if (millis() > pumpTarget)
|
||||
{
|
||||
mPlants[pumpToRun].setProperty("watertime").send(String(duration));
|
||||
@ -639,11 +642,8 @@ void pumpActiveLoop()
|
||||
mPlants[pumpToRun].setProperty("watertime").send(String(duration));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (targetReached)
|
||||
{
|
||||
|
||||
//disable all
|
||||
digitalWrite(OUTPUT_ENABLE_PUMP, LOW);
|
||||
for (int i = 0; i < MAX_PLANTS; i++)
|
||||
@ -660,7 +660,7 @@ void pumpActiveLoop()
|
||||
|
||||
void safeSetup()
|
||||
{
|
||||
throw std::runtime_error("Shit happened");
|
||||
//throw std::runtime_error("Shit happened");
|
||||
/* reduce power consumption */
|
||||
setCpuFrequencyMhz(80);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user