2020-09-07 18:18:46 +02:00
|
|
|
/**
|
|
|
|
* @file ControllerConfiguration.h
|
|
|
|
* @author your name (you@domain.com)
|
|
|
|
* @brief
|
|
|
|
* @version 0.1
|
|
|
|
* @date 2020-05-30
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2020
|
2020-11-06 22:19:16 +01:00
|
|
|
*
|
|
|
|
* \mainpage Configuration of the controller
|
|
|
|
* @{
|
|
|
|
* Describe the used PINs of the controller
|
|
|
|
*
|
|
|
|
* @subpage Controller
|
|
|
|
*
|
|
|
|
* @subpage Homie
|
|
|
|
*
|
|
|
|
* @subpage Configuration
|
|
|
|
*
|
2020-11-06 23:29:46 +01:00
|
|
|
* There are several modes in the controller
|
|
|
|
* \dot
|
|
|
|
* digraph Operationmode {
|
|
|
|
* ranksep=.75;
|
|
|
|
* poweroff [ label="off" ];
|
|
|
|
* mode1 [ label="Mode 1 - Sensor only", shape=box, width=2 ];
|
|
|
|
* mode2 [ label="Mode 2 - Wifi enabled", shape=box ];
|
|
|
|
* mode3 [ label="Mode 3 - Stay alive", shape=box ];
|
|
|
|
* mode1 -> mode2 [ label="wakeup reason", fontsize=10 ];
|
|
|
|
* mode1 -> mode2 [ label="Time duration", fontsize=10 ];
|
|
|
|
* mode2 -> mode3 [ label="Over the Air Update", fontsize=10 ];
|
|
|
|
* mode3 -> mode2 [ label="Over the Air Finished", fontsize=10 ];
|
|
|
|
* mode3 -> mode2 [ label="Mqtt Command", fontsize=10 ];
|
|
|
|
* mode2 -> mode3 [ label="Mqtt Command", fontsize=10 ];
|
|
|
|
* poweroff -> mode1 [ label="deep sleep wakeup", fontsize=10 ];
|
|
|
|
* mode1 -> poweroff [ label="enter deep sleep", fontsize=10 ];
|
|
|
|
* mode2 -> poweroff [ label="Mqtt queue empty", fontsize=10 ];
|
|
|
|
* }
|
|
|
|
* \enddot
|
|
|
|
*
|
2020-11-07 00:34:27 +01:00
|
|
|
* Before entering Deep sleep the controller is configured with an wakeup time.
|
|
|
|
*
|
2020-11-06 22:19:16 +01:00
|
|
|
* @}
|
2020-09-07 18:18:46 +02:00
|
|
|
*/
|
|
|
|
#ifndef CONTROLLER_CONFIG_H
|
|
|
|
#define CONTROLLER_CONFIG_H
|
2021-04-07 18:49:59 +02:00
|
|
|
/** \addtogroup GPIO Settings
|
2020-11-06 22:19:16 +01:00
|
|
|
* @{
|
|
|
|
*/
|
2021-05-24 15:50:04 +02:00
|
|
|
#define SENSOR_PLANT0 GPIO_NUM_32 /**< GPIO 32 (ADC1) */
|
|
|
|
#define SENSOR_PLANT1 GPIO_NUM_33 /**< GPIO 33 (ADC1) */
|
|
|
|
#define SENSOR_PLANT2 GPIO_NUM_25 /**< GPIO 25 (ADC2) */
|
|
|
|
#define SENSOR_PLANT3 GPIO_NUM_26 /**< GPIO 26 (ADC2) */
|
|
|
|
#define SENSOR_PLANT4 GPIO_NUM_27 /**< GPIO 27 (ADC2) */
|
|
|
|
#define SENSOR_PLANT5 GPIO_NUM_39 /**< SENSOR_VIN */
|
|
|
|
#define SENSOR_PLANT6 GPIO_NUM_36 /**< SENSOR_VP */
|
2020-09-20 19:18:47 +02:00
|
|
|
|
2021-05-24 15:50:04 +02:00
|
|
|
#define OUTPUT_PUMP0 GPIO_NUM_15 /**< GPIO 15 */
|
|
|
|
#define OUTPUT_PUMP1 GPIO_NUM_5 /**< GPIO 5 */
|
|
|
|
#define OUTPUT_PUMP2 GPIO_NUM_18 /**< GPIO 18 */
|
|
|
|
#define OUTPUT_PUMP3 GPIO_NUM_19 /**< GPIO 19 */
|
|
|
|
#define OUTPUT_PUMP4 GPIO_NUM_21 /**< GPIO 21 */
|
|
|
|
#define OUTPUT_PUMP5 GPIO_NUM_22 /**< GPIO 22 */
|
|
|
|
#define OUTPUT_PUMP6 GPIO_NUM_23 /**< GPIO 23 */
|
2020-09-07 18:18:46 +02:00
|
|
|
|
2021-05-24 15:50:04 +02:00
|
|
|
#define OUTPUT_ENABLE_SENSOR GPIO_NUM_14 /**< GPIO 14 - Enable Sensors */
|
|
|
|
#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 */
|
2024-02-18 15:07:06 +01:00
|
|
|
#ifdef ANALOG_WATER
|
|
|
|
#define SENSOR_TANK_ANALOG ANALOG_WATER /**< GPIO 34 - analog water sensor (GPIO_NUM_34) */
|
|
|
|
#else
|
2023-03-22 22:04:49 +01:00
|
|
|
#define SENSOR_TANK_SDA GPIO_NUM_17 /**< GPIO 17 - water sensor SDA */
|
|
|
|
#define SENSOR_TANK_SCL GPIO_NUM_16 /**< GPIO 16 - water sensor SCL */
|
2024-02-18 15:07:06 +01:00
|
|
|
#endif
|
2021-05-24 15:50:04 +02:00
|
|
|
#define BUTTON GPIO_NUM_0 /**< GPIO 0 - Fix button of NodeMCU */
|
2021-08-29 20:45:50 +02:00
|
|
|
|
|
|
|
#define CUSTOM1_PIN1 GPIO_NUM_34 /** direct gpio */
|
|
|
|
#define CUSTOM1_PIN3 GPIO_NUM_35 /** direct gpio */
|
|
|
|
#define CUSTOM1_PIN5 GPIO_NUM_2 /** mosfet controlled */
|
|
|
|
#define CUSTOM1_PIN7 GPIO_NUM_12 /** mosfet controlled */
|
|
|
|
|
2021-04-07 18:49:59 +02:00
|
|
|
/* @} */
|
|
|
|
|
|
|
|
/** \addtogroup Configuration
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2021-10-06 21:24:34 +02:00
|
|
|
#ifdef FLOWMETER_PIN
|
2022-04-27 21:19:26 +02:00
|
|
|
#define FLOWMETER_PULSES_PER_ML 2.2
|
2023-06-20 17:53:19 +02:00
|
|
|
#define FIRMWARE_FEATURE1 "Flow"
|
|
|
|
#else
|
2024-02-18 15:07:06 +01:00
|
|
|
#ifdef ANALOG_WATER
|
|
|
|
#define FIRMWARE_FEATURE1 "Water"
|
|
|
|
#else
|
2023-06-20 17:53:19 +02:00
|
|
|
#define FIRMWARE_FEATURE1 ""
|
2024-02-18 15:07:06 +01:00
|
|
|
#endif
|
2021-10-06 21:24:34 +02:00
|
|
|
#endif
|
2021-08-29 20:45:50 +02:00
|
|
|
|
2023-06-20 17:53:19 +02:00
|
|
|
#ifdef TIMED_LIGHT_PIN
|
|
|
|
#define FIRMWARE_FEATURE2 "Light"
|
|
|
|
#else
|
|
|
|
#define FIRMWARE_FEATURE2 ""
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define FIRMWARE_BASENAME "PlantControl"
|
|
|
|
#define FIRMWARE_NAME FIRMWARE_BASENAME FIRMWARE_FEATURE1 FIRMWARE_FEATURE2
|
2024-03-08 20:39:49 +01:00
|
|
|
#define FIRMWARE_VERSION "3.01 HW0.10b"
|
2023-03-22 21:43:52 +01:00
|
|
|
#define MOIST_SENSOR_MAX_FRQ 5200 // 60kHz (500Hz margin)
|
2022-04-29 10:14:50 +02:00
|
|
|
#define MOIST_SENSOR_MIN_FRQ 500 // 0.5kHz (500Hz margin)
|
2021-04-07 18:49:59 +02:00
|
|
|
|
2022-04-29 10:14:50 +02:00
|
|
|
#define ANALOG_SENSOR_MAX_MV 1300 //successive approximation of good range
|
2022-07-17 11:48:43 +02:00
|
|
|
#define ANALOG_SENSOR_MIN_MV 100 //successive approximation of good range
|
2022-02-12 05:26:54 +01:00
|
|
|
|
2021-06-29 20:14:19 +02:00
|
|
|
#define SOLAR_VOLT_FACTOR 11
|
2021-04-07 18:49:59 +02:00
|
|
|
#define BATTSENSOR_INDEX_SOLAR 0
|
|
|
|
#define BATTSENSOR_INDEX_BATTERY 1
|
2020-11-04 21:57:40 +01:00
|
|
|
|
2021-07-09 19:40:51 +02:00
|
|
|
#define MQTT_TIMEOUT (1000 * 60) /**< After 10 seconds, MQTT is expected to be connected */
|
2021-10-26 21:50:55 +02:00
|
|
|
#define ESP_STALE_TIMEOUT (MQTT_TIMEOUT+(700*1000))
|
2024-02-18 15:07:06 +01:00
|
|
|
#define ESP_ADC_MAX 4095
|
2021-04-07 21:54:53 +02:00
|
|
|
|
2020-11-06 23:29:46 +01:00
|
|
|
#define MAX_PLANTS 7
|
2023-03-25 14:21:33 +01:00
|
|
|
#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 */
|
2021-02-16 22:52:47 +01:00
|
|
|
#define VOLT_MAX_BATT 4.2f
|
2023-03-25 14:21:33 +01:00
|
|
|
#define VOLT_MIN_BATT 3.0f /**< Minimum battery voltage for normal operation */
|
|
|
|
#define LOWVOLT_SLEEP_FACTOR 3 /**< Factor for nightsleep delay, if the battery drops below minimum (@see VOLT_MIN_BATT) */
|
2023-04-06 17:56:17 +02:00
|
|
|
#define LOWVOLT_SLEEP_MINIMUM 1800 /**< At low voltage sleep at least for 30 minutes */
|
2020-09-07 18:18:46 +02:00
|
|
|
|
2024-02-18 15:07:06 +01:00
|
|
|
#define WATER_LEVEL_MINIMUM 500 /**< Minimum Analog value (1023 is the maximum)*/
|
|
|
|
|
2021-06-29 23:49:48 +02:00
|
|
|
#define MAX_CONFIG_SETTING_ITEMS 100 /**< Parameter, that can be configured in Homie */
|
|
|
|
#define MAX_JSON_CONFIG_FILE_SIZE_CUSTOM 2500
|
2020-09-21 20:42:24 +02:00
|
|
|
|
2023-03-10 22:50:16 +01:00
|
|
|
#define TEMPERATUR_TIMEOUT 3000 /**< 3 Seconds timeout for the temperatures sensors */
|
2023-03-10 23:37:50 +01:00
|
|
|
#define WATERSENSOR_TIMEOUT 3000 /**< 3 Seconds timeout for the water distance sensor */
|
2023-06-11 13:51:13 +02:00
|
|
|
#define WATERSENSOR_CYCLE 10 /**< 5 sensor measurement are performed */
|
2021-04-07 22:10:26 +02:00
|
|
|
#define DS18B20_RESOLUTION 9 /**< 9bit temperature resolution -> 0.5°C steps */
|
|
|
|
|
2021-10-06 20:05:09 +02:00
|
|
|
#define UTC_OFFSET_DE 3600 /* UTC offset in seconds for Germany */
|
|
|
|
#define UTF_OFFSET_DE_DST 3600 /* offset in seconds if daylight saving time is active */
|
|
|
|
|
2020-11-06 22:19:16 +01:00
|
|
|
/* @} */
|
2021-04-07 18:49:59 +02:00
|
|
|
|
2022-04-27 21:19:26 +02:00
|
|
|
#endif
|