fixed wrong indes for pump determination

improved pump status output
fixed led blinking in  mode3 random
This commit is contained in:
2020-11-04 21:10:22 +01:00
parent 329a228b2d
commit fb907f9b12
2 changed files with 38 additions and 12 deletions

View File

@@ -60,9 +60,24 @@ public:
* @return false
*/
bool isPumpRequired() {
return (this->mSetting->pSensorDry != NULL)
&& (this->moistureRaw.getMedian() > this->mSetting->pSensorDry->get())
&& (this->mSetting->pSensorDry->get() != DEACTIVATED_PLANT);
bool isDry = getCurrentMoisture() > getSettingsMoisture();
bool isActive = isPumpTriggerActive();
return isDry && isActive;
}
bool isPumpTriggerActive(){
return this->mSetting->pSensorDry->get() != DEACTIVATED_PLANT;
}
float getCurrentMoisture(){
return this->moistureRaw.getMedian();
}
long getSettingsMoisture(){
if(this->mSetting->pSensorDry != NULL){
return this->mSetting->pSensorDry->get();
} else {
return DEACTIVATED_PLANT;
}
}
HomieInternals::SendingPromise& setProperty(const String& property) const {