reduced settings
This commit is contained in:
parent
667eb0d275
commit
0a473173f8
@ -51,12 +51,11 @@ HomieSetting<long> waterLevelVol("waterVolume", "(ml) between minimum and maximu
|
||||
|
||||
#define GENERATE_PLANT(plant, strplant) \
|
||||
HomieSetting<long> mSensorDry##plant = HomieSetting<long>("moistdry" strplant, "Plant " strplant "- Moist sensor dry threshold"); \
|
||||
HomieSetting<long> mSensorWet##plant = HomieSetting<long>("moistwet" strplant, "Plant" strplant " - Moist sensor wet threshold"); \
|
||||
HomieSetting<long> mPumpAllowedHourRangeStart##plant = HomieSetting<long>("rangehourstart" strplant, "Plant" strplant " - Range pump allowed hour start (0-23)"); \
|
||||
HomieSetting<long> mPumpAllowedHourRangeEnd##plant = HomieSetting<long>("rangehourend" strplant, "Plant" strplant " - Range pump allowed hour end (0-23)"); \
|
||||
HomieSetting<bool> mPumpOnlyWhenLowLight##plant = HomieSetting<bool>("onlyWhenLowLightZ" strplant, "Plant" strplant " - Enable the Pump only, when there is light but not enought to charge battery"); \
|
||||
HomieSetting<long> mPumpCooldownInHours##plant = HomieSetting<long>("cooldownpump" strplant, "Plant" strplant " - How long to wait until the pump is activated again (minutes)"); \
|
||||
PlantSettings_t mSetting##plant = { &mSensorDry##plant, &mSensorWet##plant, &mPumpAllowedHourRangeStart##plant, &mPumpAllowedHourRangeEnd##plant, &mPumpOnlyWhenLowLight##plant, &mPumpCooldownInHours##plant };
|
||||
PlantSettings_t mSetting##plant = { &mSensorDry##plant, &mPumpAllowedHourRangeStart##plant, &mPumpAllowedHourRangeEnd##plant, &mPumpOnlyWhenLowLight##plant, &mPumpCooldownInHours##plant };
|
||||
|
||||
GENERATE_PLANT(0, "0");
|
||||
GENERATE_PLANT(1, "1");
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
typedef struct PlantSettings_t {
|
||||
HomieSetting<long>* pSensorDry;
|
||||
HomieSetting<long>* pSensorWet;
|
||||
HomieSetting<long>* pPumpAllowedHourRangeStart;
|
||||
HomieSetting<long>* pPumpAllowedHourRangeEnd;
|
||||
HomieSetting<bool>* pPumpOnlyWhenLowLight;
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
* @return false
|
||||
*/
|
||||
bool isPumpRequired() {
|
||||
return (this->mSetting->pSensorWet != NULL) && (this->mValue < this->mSetting->pSensorWet->get());
|
||||
return (this->mSetting->pSensorDry != NULL) && (this->mValue < this->mSetting->pSensorDry->get());
|
||||
}
|
||||
|
||||
HomieInternals::SendingPromise& setProperty(const String& property) const {
|
||||
|
@ -13,6 +13,7 @@ platform = espressif32
|
||||
board = esp32doit-devkit-v1
|
||||
framework = arduino
|
||||
build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||
board_build.partitions = default3.csv
|
||||
|
||||
; the latest development brankitchen-lightch (convention V3.0.x)
|
||||
lib_deps = ArduinoJson@6.16.1
|
||||
|
@ -24,10 +24,6 @@ void Plant::init(void) {
|
||||
this->mSetting->pSensorDry->setValidator([] (long candidate) {
|
||||
return (((candidate >= 0) && (candidate <= 4095) ) || candidate == DEACTIVATED_PLANT);
|
||||
});
|
||||
this->mSetting->pSensorWet->setDefaultValue(0);
|
||||
this->mSetting->pSensorWet->setValidator([] (long candidate) {
|
||||
return ((candidate >= 0) && (candidate <= 4095) );
|
||||
});
|
||||
this->mSetting->pPumpAllowedHourRangeStart->setDefaultValue(8); // start at 8:00
|
||||
this->mSetting->pPumpAllowedHourRangeStart->setValidator([] (long candidate) {
|
||||
return ((candidate >= 0) && (candidate <= 23) );
|
||||
|
@ -415,7 +415,6 @@ bool switchGeneralPumpHandler(const int pump, const HomieRange& range, const Str
|
||||
*/
|
||||
bool aliveHandler(const HomieRange& range, const String& value) {
|
||||
if (range.isRange) return false; // only one controller is present
|
||||
|
||||
if (value.equals("ON") || value.equals("On") || value.equals("1")) {
|
||||
mode3Active=true;
|
||||
} else {
|
||||
@ -605,7 +604,6 @@ bool mode1(){
|
||||
|
||||
void mode2(){
|
||||
Serial.println("m2");
|
||||
|
||||
systemInit();
|
||||
|
||||
/* Jump into Mode 3, if not configured */
|
||||
|
Loading…
Reference in New Issue
Block a user