reduced settings

This commit is contained in:
Empire 2020-10-20 22:52:03 +02:00
parent 667eb0d275
commit 0a473173f8
6 changed files with 3 additions and 10 deletions

View File

@ -51,12 +51,11 @@ HomieSetting<long> waterLevelVol("waterVolume", "(ml) between minimum and maximu
#define GENERATE_PLANT(plant, strplant) \ #define GENERATE_PLANT(plant, strplant) \
HomieSetting<long> mSensorDry##plant = HomieSetting<long>("moistdry" strplant, "Plant " strplant "- Moist sensor dry threshold"); \ 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> 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<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<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)"); \ 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(0, "0");
GENERATE_PLANT(1, "1"); GENERATE_PLANT(1, "1");

View File

@ -17,7 +17,6 @@
typedef struct PlantSettings_t { typedef struct PlantSettings_t {
HomieSetting<long>* pSensorDry; HomieSetting<long>* pSensorDry;
HomieSetting<long>* pSensorWet;
HomieSetting<long>* pPumpAllowedHourRangeStart; HomieSetting<long>* pPumpAllowedHourRangeStart;
HomieSetting<long>* pPumpAllowedHourRangeEnd; HomieSetting<long>* pPumpAllowedHourRangeEnd;
HomieSetting<bool>* pPumpOnlyWhenLowLight; HomieSetting<bool>* pPumpOnlyWhenLowLight;

View File

@ -76,7 +76,7 @@ public:
* @return false * @return false
*/ */
bool isPumpRequired() { 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 { HomieInternals::SendingPromise& setProperty(const String& property) const {

View File

@ -13,6 +13,7 @@ platform = espressif32
board = esp32doit-devkit-v1 board = esp32doit-devkit-v1
framework = arduino framework = arduino
build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
board_build.partitions = default3.csv
; the latest development brankitchen-lightch (convention V3.0.x) ; the latest development brankitchen-lightch (convention V3.0.x)
lib_deps = ArduinoJson@6.16.1 lib_deps = ArduinoJson@6.16.1

View File

@ -24,10 +24,6 @@ void Plant::init(void) {
this->mSetting->pSensorDry->setValidator([] (long candidate) { this->mSetting->pSensorDry->setValidator([] (long candidate) {
return (((candidate >= 0) && (candidate <= 4095) ) || candidate == DEACTIVATED_PLANT); 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->setDefaultValue(8); // start at 8:00
this->mSetting->pPumpAllowedHourRangeStart->setValidator([] (long candidate) { this->mSetting->pPumpAllowedHourRangeStart->setValidator([] (long candidate) {
return ((candidate >= 0) && (candidate <= 23) ); return ((candidate >= 0) && (candidate <= 23) );

View File

@ -415,7 +415,6 @@ bool switchGeneralPumpHandler(const int pump, const HomieRange& range, const Str
*/ */
bool aliveHandler(const HomieRange& range, const String& value) { bool aliveHandler(const HomieRange& range, const String& value) {
if (range.isRange) return false; // only one controller is present if (range.isRange) return false; // only one controller is present
if (value.equals("ON") || value.equals("On") || value.equals("1")) { if (value.equals("ON") || value.equals("On") || value.equals("1")) {
mode3Active=true; mode3Active=true;
} else { } else {
@ -605,7 +604,6 @@ bool mode1(){
void mode2(){ void mode2(){
Serial.println("m2"); Serial.println("m2");
systemInit(); systemInit();
/* Jump into Mode 3, if not configured */ /* Jump into Mode 3, if not configured */