From ab480041b29f3879fc8f04401d4ac0dd7a8f2dce Mon Sep 17 00:00:00 2001 From: Ollo Date: Fri, 10 Mar 2023 23:37:50 +0100 Subject: [PATCH] Removed timeout --- esp32/include/ControllerConfiguration.h | 2 +- esp32/src/main.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/esp32/include/ControllerConfiguration.h b/esp32/include/ControllerConfiguration.h index fcaf5b6..92af105 100644 --- a/esp32/include/ControllerConfiguration.h +++ b/esp32/include/ControllerConfiguration.h @@ -115,7 +115,7 @@ #define MAX_JSON_CONFIG_FILE_SIZE_CUSTOM 2500 #define TEMPERATUR_TIMEOUT 3000 /**< 3 Seconds timeout for the temperatures sensors */ -#define WATERSENSOR_TIMEOUT 2000 /**< 2 Seconds timeout for the water distance sensor */ +#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 */ diff --git a/esp32/src/main.cpp b/esp32/src/main.cpp index f940a9e..890391d 100644 --- a/esp32/src/main.cpp +++ b/esp32/src/main.cpp @@ -329,12 +329,13 @@ void readPowerSwitchedSensors() } } - Wire.begin(SENSOR_TANK_SDA, SENSOR_TANK_SCL, 100000UL /* 100kHz */); - tankSensor.setTimeout(500); + Wire.begin(SENSOR_TANK_SDA, SENSOR_TANK_SCL); + // Source: https://www.st.com/resource/en/datasheet/vl53l0x.pdf + tankSensor.setAddress(0x52); tankSensor.setBus(&Wire); + delay(50); long start = millis(); bool distanceReady = false; - delay(50); while ((start + WATERSENSOR_TIMEOUT) > millis()) { if (tankSensor.init()) @@ -344,7 +345,7 @@ void readPowerSwitchedSensors() } else { - delay(20); + delay(200); } } if (distanceReady)