Removed timeout

This commit is contained in:
Ollo 2023-03-10 23:37:50 +01:00
parent 1fad63a84d
commit ab480041b2
2 changed files with 6 additions and 5 deletions

View File

@ -115,7 +115,7 @@
#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 temperatures sensors */ #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 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 */

View File

@ -329,12 +329,13 @@ void readPowerSwitchedSensors()
} }
} }
Wire.begin(SENSOR_TANK_SDA, SENSOR_TANK_SCL, 100000UL /* 100kHz */); 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); tankSensor.setBus(&Wire);
delay(50);
long start = millis(); long start = millis();
bool distanceReady = false; bool distanceReady = false;
delay(50);
while ((start + WATERSENSOR_TIMEOUT) > millis()) while ((start + WATERSENSOR_TIMEOUT) > millis())
{ {
if (tankSensor.init()) if (tankSensor.init())
@ -344,7 +345,7 @@ void readPowerSwitchedSensors()
} }
else else
{ {
delay(20); delay(200);
} }
} }
if (distanceReady) if (distanceReady)