fixed wrong percent calculation, emit trigger value to mqtt
This commit is contained in:
parent
2e052710e2
commit
61098724b6
@ -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
|
||||
{
|
||||
|
@ -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()));
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user