Merge branch 'ollo-dev'

This commit is contained in:
Empire
2023-03-24 19:55:14 +01:00
10 changed files with 188 additions and 56 deletions

View File

@@ -66,8 +66,8 @@
#define OUTPUT_ENABLE_PUMP GPIO_NUM_13 /**< GPIO 13 - Enable Pumps */
#define SENSOR_ONEWIRE GPIO_NUM_4 /**< GPIO 12 - Temperatur sensor, Battery and other cool onewire stuff */
#define SENSOR_TANK_SDA GPIO_NUM_16 /**< GPIO 16 - echo feedback of water sensor */
#define SENSOR_TANK_SCL GPIO_NUM_17 /**< GPIO 17 - trigger for water sensor */
#define SENSOR_TANK_SDA GPIO_NUM_17 /**< GPIO 17 - water sensor SDA */
#define SENSOR_TANK_SCL GPIO_NUM_16 /**< GPIO 16 - water sensor SCL */
#define BUTTON GPIO_NUM_0 /**< GPIO 0 - Fix button of NodeMCU */
#define CUSTOM1_PIN1 GPIO_NUM_34 /** direct gpio */
@@ -75,8 +75,6 @@
#define CUSTOM1_PIN5 GPIO_NUM_2 /** mosfet controlled */
#define CUSTOM1_PIN7 GPIO_NUM_12 /** mosfet controlled */
#define I2C1_SDA GPIO_NUM_34 /**< GPIO 34 - I2C */
#define I2C1_SCL GPIO_NUM_35 /**< GPIO 35 - I2C */
/* @} */
/** \addtogroup Configuration
@@ -106,12 +104,15 @@
#define MAX_PLANTS 7
#define SOLAR_CHARGE_MIN_VOLTAGE 7 /**< Sun is rising (morning detected) */
#define SOLAR_CHARGE_MAX_VOLTAGE 9 /**< Sun is shining (noon) */
#define SOLAR_MAX_VOLTAGE_POSSIBLE 100 /**< higher values are treated as not connected sensor */
#define VOLT_MAX_BATT 4.2f
#define MAX_CONFIG_SETTING_ITEMS 100 /**< Parameter, that can be configured in Homie */
#define MAX_JSON_CONFIG_FILE_SIZE_CUSTOM 2500
#define TEMPERATUR_TIMEOUT 3000 /**< 3 Seconds timeout for the temperatur sensors */
#define TEMPERATUR_TIMEOUT 3000 /**< 3 Seconds timeout for the temperatures sensors */
#define WATERSENSOR_TIMEOUT 3000 /**< 3 Seconds timeout for the water distance sensor */
#define WATERSENSOR_CYCLE 5 /**< 5 sensor measurement are performed */
#define DS18B20_RESOLUTION 9 /**< 9bit temperature resolution -> 0.5°C steps */
#define UTC_OFFSET_DE 3600 /* UTC offset in seconds for Germany */

View File

@@ -107,7 +107,7 @@ HomieSetting<const char *> ntpServer("ntpServer", "NTP server (pool.ntp.org as d
HomieSetting<long> mPumpAllowedHourRangeStart##plant = HomieSetting<long>("hourstart" strplant, "Plant" strplant " - Range pump allowed hour start (0-23)"); \
HomieSetting<long> mPumpAllowedHourRangeEnd##plant = HomieSetting<long>("hourend" strplant, "Plant" strplant " - Range pump allowed hour end (0-23)"); \
HomieSetting<bool> mPumpOnlyWhenLowLight##plant = HomieSetting<bool>("lowLight" strplant, "Plant" strplant " - Enable the Pump only, when there is no sunlight"); \
HomieSetting<long> mPumpCooldownInSeconds##plant = HomieSetting<long>("delay" strplant, "Plant" strplant " - How long to wait until the pump is activated again (minutes)"); \
HomieSetting<long> mPumpCooldownInSeconds##plant = HomieSetting<long>("delay" strplant, "Plant" strplant " - How long to wait until the pump is activated again (sec)"); \
HomieSetting<long> pPumpDuration##plant = HomieSetting<long>("pumpDuration" strplant, "Plant" strplant " - time seconds to water when pump is active"); \
HomieSetting<long> pPumpMl##plant = HomieSetting<long>("pumpAmount" strplant, "Plant" strplant " - ml (if using flowmeter) to water when pump is active"); \
HomieSetting<long> pPowerLevel##plant = HomieSetting<long>("powerLevel" strplant, "Plant" strplant " - pwm duty cycle in percent"); \

View File

@@ -50,6 +50,36 @@ static const char *SENSOR_STRING[] = {
//special value to indicate a shorted sensor when the plant is not deactivated but the sensor reads short circuit value
#define SHORT_CIRCUIT_MODE -5
/**
* @brief State of plants
*
*/
#define PLANTSTATE_NUM_DEACTIVATED -1
#define PLANTSTATE_NUM_NO_SENSOR -2
#define PLANTSTATE_NUM_WET 0x00
#define PLANTSTATE_NUM_SUNNY_ALARM 0x11
#define PLANTSTATE_NUM_ACTIVE_ALARM 0x41
#define PLANTSTATE_NUM_ACTIVE_SUPESSED -3
#define PLANTSTATE_NUM_ACTIVE 0x40
#define PLANTSTATE_NUM_SUNNY 0x10
#define PLANTSTATE_NUM_COOLDOWN_ALARM 0x21
#define PLANTSTATE_NUM_COOLDOWN 0x20
#define PLANTSTATE_NUM_AFTERWORK_ALARM 0x31
#define PLANTSTATE_NUM_AFTERWORK 0x30
#define PLANTSTATE_STR_DEACTIVATED "deactivated"
#define PLANTSTATE_STR_NO_SENSOR "nosensor"
#define PLANTSTATE_STR_WET "wet"
#define PLANTSTATE_STR_SUNNY_ALARM "sunny+alarm"
#define PLANTSTATE_STR_ACTIVE_ALARM "active+alarm"
#define PLANTSTATE_STR_ACTIVE_SUPESSED "active+supressed"
#define PLANTSTATE_STR_ACTIVE "active"
#define PLANTSTATE_STR_SUNNY "sunny"
#define PLANTSTATE_STR_COOLDOWN_ALARM "cooldown+alarm"
#define PLANTSTATE_STR_COOLDOWN "cooldown"
#define PLANTSTATE_STR_AFTERWORK_ALARM "after-work+alarm"
#define PLANTSTATE_STR_AFTERWORK "after-work"
typedef struct PlantSettings_t
{
HomieSetting<double> *pSensorDry;

View File

@@ -42,4 +42,5 @@
#define LOG_SLEEP_CYCLE 102
#define LOG_MISSING_PUMP -4
#define LOG_BOOT_ERROR_DETECTION 10000
#endif
#define LOG_SOLAR_CHARGER_MISSING 300
#endif

View File

@@ -199,7 +199,7 @@ public:
return this->mSetting->pPumpOnlyWhenLowLight->get();
}
void publishState(String state);
void publishState(int stateNumber, String stateString);
bool switchHandler(const HomieRange &range, const String &value);