diff --git a/esp32/include/PlantCtrl.h b/esp32/include/PlantCtrl.h index 1946cf4..72b3078 100644 --- a/esp32/include/PlantCtrl.h +++ b/esp32/include/PlantCtrl.h @@ -92,8 +92,9 @@ public: { if (this->mSetting->pSensorDry != NULL) { - float percent = (this->mSetting->pSensorDry->get()); - return (((MOIST_SENSOR_MAX_FRQ - MOIST_SENSOR_MIN_FRQ) * percent) + MOIST_SENSOR_MIN_FRQ); + //1 is totally wet, 0 is try, 0 is MOIST_SENSOR_MAX_FRQ, 1 is MOIST_SENSOR_MIN_FRQ + float factor = (this->mSetting->pSensorDry->get()); + return map(factor,0,100,MOIST_SENSOR_MAX_FRQ,MOIST_SENSOR_MIN_FRQ); } else { diff --git a/esp32/src/PlantCtrl.cpp b/esp32/src/PlantCtrl.cpp index 117793e..a46a497 100644 --- a/esp32/src/PlantCtrl.cpp +++ b/esp32/src/PlantCtrl.cpp @@ -120,6 +120,7 @@ void Plant::postMQTTconnection(void) this->mPlant->setProperty("moist").send(String(round(pct*10)/10)); this->mPlant->setProperty("moistraw").send(String(raw)); + this->mPlant->setProperty("moisttrigger").send(String(getSetting2Moisture())); }