States described in doxygen
This commit is contained in:
parent
7080fe306b
commit
61171fb379
@ -17,6 +17,26 @@
|
|||||||
*
|
*
|
||||||
* @subpage Configuration
|
* @subpage Configuration
|
||||||
*
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
#ifndef CONTROLLER_CONFIG_H
|
#ifndef CONTROLLER_CONFIG_H
|
||||||
@ -26,10 +46,10 @@
|
|||||||
*/
|
*/
|
||||||
#define FIRMWARE_VERSION "1.0.9"
|
#define FIRMWARE_VERSION "1.0.9"
|
||||||
|
|
||||||
#define ADC_TO_VOLT(adc) ((adc) * 3.3 ) / 4095)
|
#define ADC_TO_VOLT(adc) ((adc) * 3.3 ) / 4095)
|
||||||
#define ADC_TO_VOLT_WITH_MULTI(adc, multi) (((adc)*3.3 * (multi)) / 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_MAX_ADC (85 * 4095 / 100)
|
||||||
#define MOIST_SENSOR_MIN_ADC 25 * 4095 / 100
|
#define MOIST_SENSOR_MIN_ADC (25 * 4095 / 100)
|
||||||
|
|
||||||
#define SOLAR_VOLT(adc) ADC_TO_VOLT_WITH_MULTI(adc, 4.0306) /**< 100k and 33k voltage dividor */
|
#define SOLAR_VOLT(adc) ADC_TO_VOLT_WITH_MULTI(adc, 4.0306) /**< 100k and 33k voltage dividor */
|
||||||
#define ADC_5V_TO_3V3(adc) ADC_TO_VOLT_WITH_MULTI(adc, 1.7) /**< 33k and 47k8 voltage dividor */
|
#define ADC_5V_TO_3V3(adc) ADC_TO_VOLT_WITH_MULTI(adc, 1.7) /**< 33k and 47k8 voltage dividor */
|
||||||
@ -45,27 +65,27 @@
|
|||||||
#define SENSOR_PLANT5 14 /**< GPIO 14 (ADC2) */
|
#define SENSOR_PLANT5 14 /**< GPIO 14 (ADC2) */
|
||||||
#define SENSOR_PLANT6 12 /**< GPIO 12 (ADC2) */
|
#define SENSOR_PLANT6 12 /**< GPIO 12 (ADC2) */
|
||||||
|
|
||||||
#define OUTPUT_PUMP0 23 /**< GPIO 23 */
|
#define OUTPUT_PUMP0 23 /**< GPIO 23 */
|
||||||
#define OUTPUT_PUMP1 22 /**< GPIO 22 */
|
#define OUTPUT_PUMP1 22 /**< GPIO 22 */
|
||||||
#define OUTPUT_PUMP2 21 /**< GPIO 21 */
|
#define OUTPUT_PUMP2 21 /**< GPIO 21 */
|
||||||
#define OUTPUT_PUMP3 19 /**< GPIO 19 */
|
#define OUTPUT_PUMP3 19 /**< GPIO 19 */
|
||||||
#define OUTPUT_PUMP4 18 /**< GPIO 18 */
|
#define OUTPUT_PUMP4 18 /**< GPIO 18 */
|
||||||
#define OUTPUT_PUMP5 5 /**< GPIO 5 */
|
#define OUTPUT_PUMP5 5 /**< GPIO 5 */
|
||||||
#define OUTPUT_PUMP6 15 /**< GPIO 15 */
|
#define OUTPUT_PUMP6 15 /**< GPIO 15 */
|
||||||
|
|
||||||
#define OUTPUT_SENSOR 16 /**< GPIO 16 - Enable Sensors */
|
#define OUTPUT_SENSOR 16 /**< GPIO 16 - Enable Sensors */
|
||||||
#define OUTPUT_PUMP 13 /**< GPIO 13 - Enable Pumps */
|
#define OUTPUT_PUMP 13 /**< GPIO 13 - Enable Pumps */
|
||||||
|
|
||||||
#define SENSOR_DS18B20 2 /**< GPIO 2 */
|
#define SENSOR_DS18B20 2 /**< GPIO 2 - Temperatur sensor */
|
||||||
#define BUTTON 0 /**< GPIO 0 */
|
#define BUTTON 0 /**< GPIO 0 - Fix button of NodeMCU */
|
||||||
|
|
||||||
#define MIN_TIME_RUNNING 5UL /**< Amount of seconds the controller must stay awoken */
|
#define MIN_TIME_RUNNING 5UL /**< Amount of seconds the controller must stay awoken */
|
||||||
#define MAX_PLANTS 7
|
#define MAX_PLANTS 7
|
||||||
#define MINIMUM_LIPO_VOLT 3.6f /**< Minimum voltage of the Lipo, that must be present */
|
#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 NO_LIPO_VOLT 2.0f /**< No Lipo connected */
|
||||||
#define MINIMUM_SOLAR_VOLT 4.0f /**< Minimum voltage of the sun, to detect daylight */
|
#define MINIMUM_SOLAR_VOLT 4.0f /**< Minimum voltage of the sun, to detect daylight */
|
||||||
#define SOLAR_CHARGE_MIN_VOLTAGE 7
|
#define SOLAR_CHARGE_MIN_VOLTAGE 7 /**< Sun is rising (morning detected) */
|
||||||
#define SOLAR_CHARGE_MAX_VOLTAGE 9
|
#define SOLAR_CHARGE_MAX_VOLTAGE 9 /**< Sun is shining (noon) */
|
||||||
|
|
||||||
#define HC_SR04 /**< Ultrasonic distance sensor to measure water level */
|
#define HC_SR04 /**< Ultrasonic distance sensor to measure water level */
|
||||||
#define SENSOR_SR04_ECHO 17 /**< GPIO 17 - Echo */
|
#define SENSOR_SR04_ECHO 17 /**< GPIO 17 - Echo */
|
||||||
|
@ -36,7 +36,7 @@ HomieNode sensorLipo("lipo", "Battery Status", "Lipo");
|
|||||||
HomieNode sensorSolar("solar", "Solar Status", "Solarpanel");
|
HomieNode sensorSolar("solar", "Solar Status", "Solarpanel");
|
||||||
HomieNode sensorWater("water", "WaterSensor", "Water");
|
HomieNode sensorWater("water", "WaterSensor", "Water");
|
||||||
HomieNode sensorTemp("temperature", "Temperature", "temperature");
|
HomieNode sensorTemp("temperature", "Temperature", "temperature");
|
||||||
HomieNode stayAlive("stay", "alive", "alive");
|
HomieNode stayAlive("stay", "alive", "alive"); /**< Necessary for Mqtt Active Command */
|
||||||
|
|
||||||
/* @} */
|
/* @} */
|
||||||
|
|
||||||
@ -72,7 +72,11 @@ HomieSetting<const char *> ntpServer("ntpServer", "NTP server (pool.ntp.org as d
|
|||||||
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, &mPumpAllowedHourRangeStart##plant, &mPumpAllowedHourRangeEnd##plant, &mPumpOnlyWhenLowLight##plant, &mPumpCooldownInHours##plant};
|
PlantSettings_t mSetting##plant = {&mSensorDry##plant, &mPumpAllowedHourRangeStart##plant, &mPumpAllowedHourRangeEnd##plant, &mPumpOnlyWhenLowLight##plant, &mPumpCooldownInHours##plant}; \
|
||||||
|
/**< Generate all settings for one plant
|
||||||
|
*
|
||||||
|
* Feature to start pumping only at morning: @link{SOLAR_CHARGE_MIN_VOLTAGE} and @link{SOLAR_CHARGE_MAX_VOLTAGE}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
|
@ -38,7 +38,7 @@ typedef struct
|
|||||||
} rtc_plant_t;
|
} rtc_plant_t;
|
||||||
|
|
||||||
/********************* non volatile enable after deepsleep *******************************/
|
/********************* non volatile enable after deepsleep *******************************/
|
||||||
RTC_DATA_ATTR rtc_plant_t rtcPlant[7];
|
RTC_DATA_ATTR rtc_plant_t rtcPlant[MAX_PLANTS];
|
||||||
RTC_DATA_ATTR long gotoMode2AfterThisTimestamp = 0;
|
RTC_DATA_ATTR long gotoMode2AfterThisTimestamp = 0;
|
||||||
RTC_DATA_ATTR long rtcDeepSleepTime = 0; /**< Time, when the microcontroller shall be up again */
|
RTC_DATA_ATTR long rtcDeepSleepTime = 0; /**< Time, when the microcontroller shall be up again */
|
||||||
RTC_DATA_ATTR int lastPumpRunning = 0;
|
RTC_DATA_ATTR int lastPumpRunning = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user