From eb7a54285fa1477962d67b849fe6fec4ef52beaf Mon Sep 17 00:00:00 2001 From: Fisch Date: Wed, 1 Feb 2023 21:48:54 +0100 Subject: [PATCH] try to fix sensoresp7. fix vl53l1x i2c speed --- platformio.ini | 48 +++++------------------------------------- src/sensor_vl53l1x.cpp | 2 ++ 2 files changed, 7 insertions(+), 43 deletions(-) diff --git a/platformio.ini b/platformio.ini index cc5f933..e9949c1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -297,6 +297,7 @@ lib_deps = ArduinoJson@6.16.1 #dependency of homie. using older version because of "ambiguous overload for operator|" error Homie@3.0.0 claws/BH1750@1.1.4 + SPI #Badezimmer [env:sensoresp7] @@ -309,28 +310,21 @@ monitor_port = COM3 monitor_speed = 115200 build_flags = - -D SENSOR_HCSR501 -D SENSOR_HCSR501_PIN=D6 -D SENSOR_VL53L1X -D SENSOR_VL53L1X_minchange=200 -D SENSOR_VL53L1X_senddelaymax=1000*30 - -D SENSOR_VL53L1X_readdelay=500 - - -D SENSOR_HTU21D - -D dataHTU21D_temperature_minchange=0.2 - -D dataHTU21D_temperature_senddelaymax=1000*60*30 - -D dataHTU21D_humidity_minchange=1.0 - -D dataHTU21D_humidity_senddelaymax=1000*60*30 + -D SENSOR_VL53L1X_readdelay=250 + lib_deps = Bounce2 - SPI ArduinoJson@6.16.1 marvinroger/Homie @ ^3.0.1 pololu/VL53L1X @ ^1.3.0 - adafruit/Adafruit HTU21DF Library @ ^1.0.5 + #3D Printer [env:sensoresp3dprinter] @@ -354,37 +348,5 @@ lib_deps = adafruit/Adafruit HTU21DF Library @ ^1.0.5 ArduinoJson@6.16.1 #dependency of homie. using older version because of "ambiguous overload for operator|" error Homie@3.0.0 + SPI - - - - -#Test -[env:sensoresptest] -platform = espressif8266 @ 2.5.0 -board = d1_mini -framework = arduino - -monitor_port = /dev/ttyUSB0 -monitor_speed = 115200 - -build_flags = - - -D SENSOR_HTU21D - -D dataHTU21D_temperature_minchange=0.2 - -D dataHTU21D_temperature_senddelaymax=1000*60*30 - -D dataHTU21D_humidity_minchange=1.0 - -D dataHTU21D_humidity_senddelaymax=1000*60*30 - - - -D SENSOR_TCS34725 - -D SENSOR_TCS34725_LUX_minchange=500 - -D SENSOR_TCS34725_LUX_senddelaymax=1000*60*1 - -D SENSOR_TCS34725_COLORTEMP_minchange=100 - -D SENSOR_TCS34725_LUXFACTOR=0.3 #measured with luxmeter. with half tennis ball was 1.7ev less. 1/2^1.7=0,3078 - -lib_deps = - ArduinoJson@6.16.1 #dependency of homie. using older version because of "ambiguous overload for operator|" error - Homie@3.0.0 - adafruit/Adafruit HTU21DF Library @ ^1.0.5 - https://github.com/adafruit/Adafruit_TCS34725#1.3.5 \ No newline at end of file diff --git a/src/sensor_vl53l1x.cpp b/src/sensor_vl53l1x.cpp index d8bc803..4aa6f14 100644 --- a/src/sensor_vl53l1x.cpp +++ b/src/sensor_vl53l1x.cpp @@ -10,6 +10,8 @@ Sensor_VL53L1X::Sensor_VL53L1X() void Sensor_VL53L1X::init() //Things to be done during setup() { Serial.println("initializing vl53l1x"); + Wire.begin(); + Wire.setClock(400000); // use 400 kHz I2C vl53l1x->setTimeout(500); if (!vl53l1x->init()) { Serial.println("No vl53l1x found!");