Plant object expanded with settings

This commit is contained in:
c3ma
2020-10-14 20:07:56 +02:00
parent 24b842f5a3
commit 1a4cddc366
5 changed files with 90 additions and 94 deletions

View File

@@ -47,7 +47,8 @@
#define MIN_TIME_RUNNING 5UL /**< Amount of seconds the controller must stay awoken */
#define MAX_PLANTS 7
#define EMPTY_LIPO_MULTIPL 3 /**< Multiplier to increase time for sleeping when lipo is empty */
#define MINIMUM_LIPO_VOLT 3.3f /**< Minimum voltage of the Lipo, that must be present */
#define MINIMUM_LIPO_VOLT 3.6f /**< Minimum voltage of the Lipo, that must be present */
#define NO_LIPO_VOLT 2.0f /**< No Lipo connected */
#define MINIMUM_SOLAR_VOLT 4.0f /**< Minimum voltage of the sun, to detect daylight */
#define HC_SR04 /**< Ultrasonic distance sensor to measure water level */

View File

@@ -25,9 +25,12 @@ private:
int mAnalogValue=0; /**< moist sensor values, used for a calculation */
HomieNode *mPlant = NULL;
HomieSetting<long> *mSensorTriggerLevel=NULL;
HomieSetting<long> *mWateringTime=NULL;
HomieSetting<long> *mWateringIdleTime=NULL;
HomieSetting<long> *mSensorDry;
HomieSetting<long> *mSensorWet;
HomieSetting<long> *mPumpAllowedHourRangeStart;
HomieSetting<long> *mPumpAllowedHourRangeEnd;
HomieSetting<bool> *mPumpOnlyWhenLowLight;
HomieSetting<long> *mPumpCooldownInHours;
public:
@@ -38,10 +41,7 @@ public:
* @param pinPump Pin of the Pump to use
*/
Plant(int pinSensor, int pinPump,
HomieNode *plant,
HomieSetting<long> *sensorTriggerLevel,
HomieSetting<long> *wateringTime,
HomieSetting<long> *wateringIdleTime);
int plantId);
/**
* @brief Add a value, to be measured
@@ -81,7 +81,7 @@ public:
* @return false
*/
bool isPumpRequired() {
return (this->mSensorTriggerLevel != NULL) && (this->mValue < this->mSensorTriggerLevel->get());
return (this->mSensorWet != NULL) && (this->mValue < this->mSensorWet->get());
}
HomieInternals::SendingPromise& setProperty(const String& property) const {