Sensor types are defined in platformio.ini
This commit is contained in:
parent
9a172c269e
commit
6c475a2ade
@ -27,6 +27,8 @@
|
||||
#define NUMBER_TYPE "Float" /**< numberic information, published or read in Homie */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
* @name Temperatur Node
|
||||
* @{
|
||||
**/
|
||||
|
@ -13,12 +13,22 @@
|
||||
|
||||
#include <Homie.h>
|
||||
|
||||
/**
|
||||
* @name Sensor types
|
||||
* possible sensors:
|
||||
* @{
|
||||
**/
|
||||
|
||||
#define FOREACH_SENSOR(SENSOR) \
|
||||
SENSOR(NONE) \
|
||||
SENSOR(CAPACITIVE_FREQUENCY) \
|
||||
SENSOR(ANALOG_RESISTANCE_PROBE) \
|
||||
SENSOR(SHT20)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#define GENERATE_ENUM(ENUM) ENUM,
|
||||
#define GENERATE_STRING(STRING) #STRING,
|
||||
|
||||
|
@ -13,6 +13,13 @@ platform = espressif32
|
||||
board = esp32doit-devkit-v1
|
||||
framework = arduino
|
||||
build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||
-DPLANT0_SENSORTYPE=SHT20
|
||||
-DPLANT1_SENSORTYPE=ANALOG_RESISTANCE_PROBE
|
||||
-DPLANT2_SENSORTYPE=CAPACITIVE_FREQUENCY
|
||||
-DPLANT3_SENSORTYPE=CAPACITIVE_FREQUENCY
|
||||
-DPLANT4_SENSORTYPE=CAPACITIVE_FREQUENCY
|
||||
-DPLANT5_SENSORTYPE=CAPACITIVE_FREQUENCY
|
||||
-DPLANT6_SENSORTYPE=CAPACITIVE_FREQUENCY
|
||||
board_build.partitions = defaultWithSmallerSpiffs.csv
|
||||
|
||||
|
||||
|
@ -92,14 +92,36 @@ DallasTemperature sensors(&oneWire);
|
||||
DS2438 battery(&oneWire, 0.0333333f, AMOUNT_SENOR_QUERYS);
|
||||
VL53L0X tankSensor;
|
||||
|
||||
#ifndef PLANT0_SENSORTYPE
|
||||
#error "Sensor type must be specified, see HomieTypes.h - Sensor types"
|
||||
#endif
|
||||
#ifndef PLANT1_SENSORTYPE
|
||||
#error "Sensor type must be specified, see HomieTypes.h - Sensor types"
|
||||
#endif
|
||||
#ifndef PLANT2_SENSORTYPE
|
||||
#error "Sensor type must be specified, see HomieTypes.h - Sensor types"
|
||||
#endif
|
||||
#ifndef PLANT3_SENSORTYPE
|
||||
#error "Sensor type must be specified, see HomieTypes.h - Sensor types"
|
||||
#endif
|
||||
#ifndef PLANT4_SENSORTYPE
|
||||
#error "Sensor type must be specified, see HomieTypes.h - Sensor types"
|
||||
#endif
|
||||
#ifndef PLANT5_SENSORTYPE
|
||||
#error "Sensor type must be specified, see HomieTypes.h - Sensor types"
|
||||
#endif
|
||||
#ifndef PLANT6_SENSORTYPE
|
||||
#error "Sensor type must be specified, see HomieTypes.h - Sensor types"
|
||||
#endif
|
||||
|
||||
Plant mPlants[MAX_PLANTS] = {
|
||||
Plant(SENSOR_PLANT0, OUTPUT_PUMP0, 0, &plant0, &mSetting0, SHT20),
|
||||
Plant(SENSOR_PLANT1, OUTPUT_PUMP1, 1, &plant1, &mSetting1, ANALOG_RESISTANCE_PROBE),
|
||||
Plant(SENSOR_PLANT2, OUTPUT_PUMP2, 2, &plant2, &mSetting2, CAPACITIVE_FREQUENCY),
|
||||
Plant(SENSOR_PLANT3, OUTPUT_PUMP3, 3, &plant3, &mSetting3, CAPACITIVE_FREQUENCY),
|
||||
Plant(SENSOR_PLANT4, OUTPUT_PUMP4, 4, &plant4, &mSetting4, CAPACITIVE_FREQUENCY),
|
||||
Plant(SENSOR_PLANT5, OUTPUT_PUMP5, 5, &plant5, &mSetting5, CAPACITIVE_FREQUENCY),
|
||||
Plant(SENSOR_PLANT6, OUTPUT_PUMP6, 6, &plant6, &mSetting6, CAPACITIVE_FREQUENCY)};
|
||||
Plant(SENSOR_PLANT0, OUTPUT_PUMP0, 0, &plant0, &mSetting0, PLANT0_SENSORTYPE),
|
||||
Plant(SENSOR_PLANT1, OUTPUT_PUMP1, 1, &plant1, &mSetting1, PLANT1_SENSORTYPE),
|
||||
Plant(SENSOR_PLANT2, OUTPUT_PUMP2, 2, &plant2, &mSetting2, PLANT2_SENSORTYPE),
|
||||
Plant(SENSOR_PLANT3, OUTPUT_PUMP3, 3, &plant3, &mSetting3, PLANT3_SENSORTYPE),
|
||||
Plant(SENSOR_PLANT4, OUTPUT_PUMP4, 4, &plant4, &mSetting4, PLANT4_SENSORTYPE),
|
||||
Plant(SENSOR_PLANT5, OUTPUT_PUMP5, 5, &plant5, &mSetting5, PLANT5_SENSORTYPE),
|
||||
Plant(SENSOR_PLANT6, OUTPUT_PUMP6, 6, &plant6, &mSetting6, PLANT6_SENSORTYPE)};
|
||||
|
||||
/******************************************************************************
|
||||
* LOCAL FUNCTIONS
|
||||
|
Loading…
Reference in New Issue
Block a user