PlantCtrl/esp32/include/ControllerConfiguration.h

106 lines
4.0 KiB
C
Raw Normal View History

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
2020-11-06 22:19:16 +01:00
/** \addtogroup Configuration
* @{
*/
#define FIRMWARE_VERSION "1.0.10"
2020-09-07 18:18:46 +02:00
2020-11-06 23:29:46 +01:00
#define ADC_TO_VOLT(adc) ((adc) * 3.3 ) / 4095)
#define ADC_TO_VOLT_WITH_MULTI(adc, multi) (((adc)*3.3 * (multi)) / 4095)
#define MOIST_SENSOR_MAX_ADC (85 * 4095 / 100)
#define MOIST_SENSOR_MIN_ADC (25 * 4095 / 100)
2020-09-07 18:18:46 +02:00
#define SOLAR_VOLT(adc) ADC_TO_VOLT_WITH_MULTI(adc, 4.0306) /**< 100k and 33k voltage dividor */
2020-11-07 00:34:27 +01:00
#define ADC_5V_TO_3V3(adc) ADC_TO_VOLT_WITH_MULTI(adc, 1.69) /**< 33k and 47k8 voltage dividor */
#define MS_TO_S 1000
2020-09-07 18:18:46 +02:00
#define SENSOR_LIPO 34 /**< GPIO 34 (ADC1) */
#define SENSOR_SOLAR 35 /**< GPIO 35 (ADC1) */
#define SENSOR_PLANT0 12 /**< GPIO 32 (ADC1) */
#define SENSOR_PLANT1 14/**< GPIO 33 (ADC1) */
#define SENSOR_PLANT2 27 /**< GPIO 25 (ADC2) */
#define SENSOR_PLANT3 26 /**< GPIO 26 (ADC2) */
#define SENSOR_PLANT4 25 /**< GPIO 27 (ADC2) */
#define SENSOR_PLANT5 14 /**< GPIO 14 (ADC2) */
#define SENSOR_PLANT6 12 /**< GPIO 12 (ADC2) */
#define OUTPUT_PUMP0 15 /**< GPIO 23 */
#define OUTPUT_PUMP1 5 /**< GPIO 22 */
#define OUTPUT_PUMP2 18 /**< GPIO 21 */
#define OUTPUT_PUMP3 19 /**< GPIO 19 */
#define OUTPUT_PUMP4 21 /**< GPIO 18 */
#define OUTPUT_PUMP5 22 /**< GPIO 5 */
#define OUTPUT_PUMP6 23 /**< GPIO 15 */
2020-09-07 18:18:46 +02:00
#define OUTPUT_SENSOR 16 /**< GPIO 16 - Enable Sensors */
2020-11-06 23:29:46 +01:00
#define OUTPUT_PUMP 13 /**< GPIO 13 - Enable Pumps */
2020-09-07 18:18:46 +02:00
2020-11-06 23:29:46 +01:00
#define SENSOR_DS18B20 2 /**< GPIO 2 - Temperatur sensor */
#define BUTTON 0 /**< GPIO 0 - Fix button of NodeMCU */
2020-11-06 23:29:46 +01:00
#define MIN_TIME_RUNNING 5UL /**< Amount of seconds the controller must stay awoken */
#define MAX_PLANTS 7
#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 SOLAR_CHARGE_MIN_VOLTAGE 7 /**< Sun is rising (morning detected) */
#define SOLAR_CHARGE_MAX_VOLTAGE 9 /**< Sun is shining (noon) */
2020-09-07 18:18:46 +02:00
2020-10-16 16:22:48 +02:00
#define MAX_CONFIG_SETTING_ITEMS 50 /**< Parameter, that can be configured in Homie */
2020-09-21 20:42:24 +02:00
#define PANIK_MODE_DEEPSLEEP (60 * 60 * 5U) /**< 5 hours in usecond */
#define PANIK_MODE_DEEPSLEEP_US (PANIK_MODE_DEEPSLEEP * 1000 * 1000)
2020-10-21 18:33:38 +02:00
2020-11-06 21:00:11 +01:00
#define TEMPERATURE_DELTA_TRIGGER_IN_C 1.0f
2020-11-06 18:52:38 +01:00
#define MOIST_DELTA_TRIGGER_ADC 10
#define SOLAR_DELTA_VOLT_ADC 3
#define LIPO_DELTA_VOLT_ADC 0.2 /**< trigger for lipo voltage */
2020-11-04 21:55:51 +01:00
2020-12-28 14:24:55 +01:00
#define TEMPERATUR_TIMEOUT 3000 /**< 3 Seconds timeout for the temperatur sensors */
#define TEMP_SENSOR_MEASURE_SERIES 5
2020-11-06 22:19:16 +01:00
/* @} */
#endif