Merge branch 'ollo-dev' of github.com:0110/PlantCtrl into ollo-dev
This commit is contained in:
commit
1e79588e98
@ -75,8 +75,6 @@
|
|||||||
#define CUSTOM1_PIN5 GPIO_NUM_2 /** mosfet controlled */
|
#define CUSTOM1_PIN5 GPIO_NUM_2 /** mosfet controlled */
|
||||||
#define CUSTOM1_PIN7 GPIO_NUM_12 /** 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
|
/** \addtogroup Configuration
|
||||||
@ -116,7 +114,9 @@
|
|||||||
#define MAX_CONFIG_SETTING_ITEMS 100 /**< Parameter, that can be configured in Homie */
|
#define MAX_CONFIG_SETTING_ITEMS 100 /**< Parameter, that can be configured in Homie */
|
||||||
#define MAX_JSON_CONFIG_FILE_SIZE_CUSTOM 2500
|
#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 DS18B20_RESOLUTION 9 /**< 9bit temperature resolution -> 0.5°C steps */
|
||||||
|
|
||||||
#define UTC_OFFSET_DE 3600 /* UTC offset in seconds for Germany */
|
#define UTC_OFFSET_DE 3600 /* UTC offset in seconds for Germany */
|
||||||
|
@ -329,11 +329,14 @@ void readPowerSwitchedSensors()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
waterRawSensor.clear();
|
Wire.begin(SENSOR_TANK_SDA, SENSOR_TANK_SCL);
|
||||||
tankSensor.setTimeout(500);
|
// Source: https://www.st.com/resource/en/datasheet/vl53l0x.pdf
|
||||||
|
tankSensor.setAddress(0x52);
|
||||||
|
tankSensor.setBus(&Wire);
|
||||||
|
delay(50);
|
||||||
long start = millis();
|
long start = millis();
|
||||||
bool distanceReady = false;
|
bool distanceReady = false;
|
||||||
while (start + 500 > millis())
|
while ((start + WATERSENSOR_TIMEOUT) > millis())
|
||||||
{
|
{
|
||||||
if (tankSensor.init())
|
if (tankSensor.init())
|
||||||
{
|
{
|
||||||
@ -342,17 +345,18 @@ void readPowerSwitchedSensors()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delay(20);
|
delay(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (distanceReady)
|
if (distanceReady)
|
||||||
{
|
{
|
||||||
|
waterRawSensor.clear();
|
||||||
tankSensor.setSignalRateLimit(0.1);
|
tankSensor.setSignalRateLimit(0.1);
|
||||||
// increase laser pulse periods (defaults are 14 and 10 PCLKs)
|
// increase laser pulse periods (defaults are 14 and 10 PCLKs)
|
||||||
tankSensor.setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18);
|
tankSensor.setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18);
|
||||||
tankSensor.setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14);
|
tankSensor.setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14);
|
||||||
tankSensor.setMeasurementTimingBudget(200000);
|
tankSensor.setMeasurementTimingBudget(200000);
|
||||||
for (int readCnt = 0; readCnt < 5; readCnt++)
|
for (int readCnt = 0; readCnt < WATERSENSOR_CYCLE; readCnt++)
|
||||||
{
|
{
|
||||||
if (!tankSensor.timeoutOccurred())
|
if (!tankSensor.timeoutOccurred())
|
||||||
{
|
{
|
||||||
@ -362,7 +366,7 @@ void readPowerSwitchedSensors()
|
|||||||
waterRawSensor.add(distance);
|
waterRawSensor.add(distance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delay(10);
|
delay(50);
|
||||||
}
|
}
|
||||||
Serial << "Distance sensor " << waterRawSensor.getMedian() << " mm" << endl;
|
Serial << "Distance sensor " << waterRawSensor.getMedian() << " mm" << endl;
|
||||||
}
|
}
|
||||||
@ -802,7 +806,6 @@ void safeSetup()
|
|||||||
{
|
{
|
||||||
mPlants[i].initSensors();
|
mPlants[i].initSensors();
|
||||||
}
|
}
|
||||||
Wire.begin(SENSOR_TANK_SDA, SENSOR_TANK_SCL);
|
|
||||||
readPowerSwitchedSensors();
|
readPowerSwitchedSensors();
|
||||||
|
|
||||||
Homie.setup();
|
Homie.setup();
|
||||||
|
Loading…
Reference in New Issue
Block a user