mirror of https://github.com/arendst/Tasmota.git
Merge pull request #15108 from barbudor/vl53l1x_xshut
Support up to 8x VL53L1X using XSHUT pin
This commit is contained in:
commit
ef730606ac
|
@ -255,7 +255,7 @@ const be_const_member_t lv_gpio_constants[] = {
|
|||
{ "TX2X_TXD_BLACK", (int32_t) GPIO_TX2X_TXD_BLACK },
|
||||
{ "TXD", (int32_t) GPIO_TXD },
|
||||
{ "VINDRIKTNING_RX", (int32_t) GPIO_VINDRIKTNING_RX },
|
||||
{ "VL53L0X_XSHUT1", (int32_t) GPIO_VL53L0X_XSHUT1 },
|
||||
{ "VL53LXX_XSHUT1", (int32_t) GPIO_VL53LXX_XSHUT1 },
|
||||
{ "WE517_RX", (int32_t) GPIO_WE517_RX },
|
||||
{ "WE517_TX", (int32_t) GPIO_WE517_TX },
|
||||
{ "WEBCAM_DATA", (int32_t) GPIO_WEBCAM_DATA },
|
||||
|
|
|
@ -245,7 +245,7 @@ gpio.SSD1351_DC = 226
|
|||
gpio.XPT2046_CS = 227
|
||||
gpio.CSE7761_TX = 228
|
||||
gpio.CSE7761_RX = 229
|
||||
gpio.VL53L0X_XSHUT1 = 230
|
||||
gpio.VL53LXX_XSHUT1 = 230
|
||||
gpio.MAX7219CLK = 231
|
||||
gpio.MAX7219DIN = 232
|
||||
gpio.MAX7219CS = 233
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Puls"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "Cruce por cero"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool TX"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool RX"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand - D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool - TX"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool - RX"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ - TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ - RX"
|
||||
#define D_SENSOR_ZEROCROSS "Impulsi ZC"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -838,7 +838,7 @@
|
|||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
#define D_SENSOR_NEOPOOL_TX "NeoPool Tx"
|
||||
#define D_SENSOR_NEOPOOL_RX "NeoPool Rx"
|
||||
#define D_SENSOR_VL53L0X_XSHUT "VL53L0X XSHUT"
|
||||
#define D_SENSOR_VL53LXX_XSHUT "VL53LXX XSHUT"
|
||||
#define D_SENSOR_TFMINIPLUS_TX "TFmini+ TX"
|
||||
#define D_SENSOR_TFMINIPLUS_RX "TFmini+ RX"
|
||||
#define D_SENSOR_ZEROCROSS "ZC Pulse"
|
||||
|
|
|
@ -622,7 +622,10 @@
|
|||
// #define USE_ADE7880 // [I2cDriver65] Enable ADE7880 Energy monitor as used on Shelly 3EM (I2C address 0x38) (+3k8)
|
||||
#define USE_ADE7953 // [I2cDriver7] Enable ADE7953 Energy monitor as used on Shelly 2.5 (I2C address 0x38) (+1k5)
|
||||
// #define USE_VL53L0X // [I2cDriver31] Enable VL53L0x time of flight sensor (I2C address 0x29) (+4k code)
|
||||
// #define VL53L0X_XSHUT_ADDRESS 0x78 // VL53L0X base address when used with XSHUT control
|
||||
// #define USE_VL53L1X // [I2cDriver54] Enable VL53L1X time of flight sensor (I2C address 0x29) using Pololu VL53L1X library (+2k9 code)
|
||||
// #define VL53L1X_XSHUT_ADDRESS 0x78 // VL53L1X base address when used with XSHUT control
|
||||
// #define VL53L1X_DISTANCE_MODE Long // VL53L1X distance mode : Long | Medium | Short
|
||||
// #define USE_TOF10120 // [I2cDriver57] Enable TOF10120 time of flight sensor (I2C address 0x52) (+0k6 code)
|
||||
// #define USE_MLX90614 // [I2cDriver32] Enable MLX90614 ir temp sensor (I2C address 0x5a) (+0.6k code)
|
||||
// #define USE_CHIRP // [I2cDriver33] Enable CHIRP soil moisture sensor (variable I2C address, default 0x20)
|
||||
|
|
|
@ -94,7 +94,7 @@ const uint8_t MAX_SHUTTER_KEYS = 4; // Max number of shutter keys or but
|
|||
const uint8_t MAX_PCF8574 = 4; // Max number of PCF8574 devices
|
||||
const uint8_t MAX_RULE_SETS = 3; // Max number of rule sets of size 512 characters
|
||||
const uint16_t MAX_RULE_SIZE = 512; // Max number of characters in rules
|
||||
const uint16_t VL53L0X_MAX_SENSORS = 8; // Max number of VL53L0X sensors
|
||||
const uint16_t VL53LXX_MAX_SENSORS = 8; // Max number of VL53L0X sensors
|
||||
|
||||
#ifdef ESP32
|
||||
const uint8_t MAX_I2C = 2; // Max number of I2C controllers (ESP32 = 2)
|
||||
|
|
|
@ -154,7 +154,7 @@ enum UserSelectablePins {
|
|||
GPIO_SSD1351_DC,
|
||||
GPIO_XPT2046_CS, // XPT2046 SPI Chip Select
|
||||
GPIO_CSE7761_TX, GPIO_CSE7761_RX, // CSE7761 Serial interface (Dual R3)
|
||||
GPIO_VL53L0X_XSHUT1, // VL53L0X_XSHUT (the max number of sensors is VL53L0X_MAX_SENSORS)- Used when connecting multiple VL53L0X
|
||||
GPIO_VL53LXX_XSHUT1, // VL53LXX_XSHUT (the max number of sensors is VL53LXX_MAX_SENSORS)- Used when connecting multiple VL53LXX
|
||||
GPIO_MAX7219CLK, GPIO_MAX7219DIN, GPIO_MAX7219CS, // MAX7219 interface
|
||||
GPIO_TFMINIPLUS_TX, GPIO_TFMINIPLUS_RX, // TFmini Plus ToF sensor
|
||||
GPIO_ZEROCROSS,
|
||||
|
@ -378,7 +378,7 @@ const char kSensorNames[] PROGMEM =
|
|||
D_SENSOR_SSD1351_DC "|"
|
||||
D_SENSOR_XPT2046_CS "|"
|
||||
D_SENSOR_CSE7761_TX "|" D_SENSOR_CSE7761_RX "|"
|
||||
D_SENSOR_VL53L0X_XSHUT "|"
|
||||
D_SENSOR_VL53LXX_XSHUT "|"
|
||||
D_SENSOR_MAX7219_CLK "|" D_SENSOR_MAX7219_DIN "|" D_SENSOR_MAX7219_CS "|"
|
||||
D_SENSOR_TFMINIPLUS_TX "|" D_SENSOR_TFMINIPLUS_RX "|"
|
||||
D_SENSOR_ZEROCROSS "|"
|
||||
|
@ -940,8 +940,8 @@ const uint16_t kGpioNiceList[] PROGMEM = {
|
|||
AGPIO(GPIO_PROJECTOR_CTRL_TX), // LCD/DLP Projector Serial Control
|
||||
AGPIO(GPIO_PROJECTOR_CTRL_RX), // LCD/DLP Projector Serial Control
|
||||
#endif
|
||||
#ifdef USE_VL53L0X
|
||||
AGPIO(GPIO_VL53L0X_XSHUT1) + VL53L0X_MAX_SENSORS, // When using multiple VL53L0X.
|
||||
#if defined(USE_VL53L0X) or defined (USE_VL53L1X)
|
||||
AGPIO(GPIO_VL53LXX_XSHUT1) + VL53LXX_MAX_SENSORS, // When using multiple VL53LXX.
|
||||
#endif
|
||||
|
||||
#ifdef USE_DISPLAY_MAX7219
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* Standard (https://i2cdevices.org/addresses) those addresses are used by the PCA9685, so take into
|
||||
* account they won't work together.
|
||||
*
|
||||
* The default value of VL53L0X_MAX_SENSORS is set in the file tasmota.h
|
||||
* The default value of VL53LXX_MAX_SENSORS is set in the file tasmota.h
|
||||
* Changing that is backwards incompatible - Max supported devices by this driver are 8
|
||||
*
|
||||
**********************************************************************************************
|
||||
|
@ -69,69 +69,74 @@
|
|||
#include <Wire.h>
|
||||
#include "VL53L0X.h"
|
||||
|
||||
VL53L0X sensor[VL53L0X_MAX_SENSORS];
|
||||
#define VL53L0X_ADDRESS 0x29
|
||||
#ifndef VL53L0X_XSHUT_ADDRESS
|
||||
#define VL53L0X_XSHUT_ADDRESS 0x78
|
||||
#endif
|
||||
|
||||
VL53L0X VL53L0X_device[VL53LXX_MAX_SENSORS];
|
||||
struct {
|
||||
uint16_t distance;
|
||||
uint16_t distance_prev;
|
||||
uint16_t buffer[5];
|
||||
uint8_t ready = 0;
|
||||
uint8_t index;
|
||||
} Vl53l0x[VL53L0X_MAX_SENSORS];
|
||||
} Vl53l0x_data[VL53LXX_MAX_SENSORS];
|
||||
|
||||
bool xshut = false;
|
||||
bool VL53L0X_xshut = false;
|
||||
bool VL53L0X_detected = false;
|
||||
|
||||
/********************************************************************************************/
|
||||
|
||||
void Vl53l0Detect(void) {
|
||||
|
||||
for (uint32_t i = 0; i < VL53L0X_MAX_SENSORS; i++) {
|
||||
if (PinUsed(GPIO_VL53L0X_XSHUT1, i)) {
|
||||
pinMode(Pin(GPIO_VL53L0X_XSHUT1, i), OUTPUT);
|
||||
digitalWrite(Pin(GPIO_VL53L0X_XSHUT1, i), i==0 ? 1 : 0);
|
||||
xshut = true;
|
||||
for (uint32_t i = 0; i < VL53LXX_MAX_SENSORS; i++) {
|
||||
if (PinUsed(GPIO_VL53LXX_XSHUT1, i)) {
|
||||
pinMode(Pin(GPIO_VL53LXX_XSHUT1, i), OUTPUT);
|
||||
digitalWrite(Pin(GPIO_VL53LXX_XSHUT1, i), i==0 ? 1 : 0);
|
||||
VL53L0X_xshut = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < VL53L0X_MAX_SENSORS; i++) {
|
||||
if (PinUsed(GPIO_VL53L0X_XSHUT1, i) || (!xshut)) {
|
||||
if (xshut) { pinMode(Pin(GPIO_VL53L0X_XSHUT1, i), INPUT); delay(1); }
|
||||
if (!I2cSetDevice(0x29) && !I2cSetDevice((uint8_t)(120+i))) { return; } // Detection for unconfigured OR configured sensor
|
||||
if (sensor[i].init()) {
|
||||
if (xshut) { sensor[i].setAddress((uint8_t)(120+i)); }
|
||||
uint8_t addr = sensor[i].getAddress();
|
||||
if (xshut) {
|
||||
for (uint32_t i = 0; i < VL53LXX_MAX_SENSORS; i++) {
|
||||
if (PinUsed(GPIO_VL53LXX_XSHUT1, i) || (!VL53L0X_xshut)) {
|
||||
if (VL53L0X_xshut) { pinMode(Pin(GPIO_VL53LXX_XSHUT1, i), INPUT); delay(1); }
|
||||
if (!I2cSetDevice(VL53L0X_ADDRESS) && !I2cSetDevice((uint8_t)(VL53L0X_XSHUT_ADDRESS+i))) { return; } // Detection for unconfigured OR configured sensor
|
||||
if (VL53L0X_device[i].init()) {
|
||||
if (VL53L0X_xshut) { VL53L0X_device[i].setAddress((uint8_t)(VL53L0X_XSHUT_ADDRESS+i)); }
|
||||
uint8_t addr = VL53L0X_device[i].getAddress();
|
||||
if (VL53L0X_xshut) {
|
||||
I2cSetActive(addr);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_I2C D_SENSOR " VL53L0X %d " D_SENSOR_DETECTED " - " D_NEW_ADDRESS " 0x%02X"), i+1, addr);
|
||||
} else {
|
||||
I2cSetActiveFound(addr, "VL53L0X");
|
||||
}
|
||||
sensor[i].setTimeout(500);
|
||||
VL53L0X_device[i].setTimeout(500);
|
||||
|
||||
#if defined VL53L0X_LONG_RANGE
|
||||
// lower the return signal rate limit (default is 0.25 MCPS)
|
||||
sensor[i].setSignalRateLimit(0.1);
|
||||
VL53L0X_device[i].setSignalRateLimit(0.1);
|
||||
// increase laser pulse periods (defaults are 14 and 10 PCLKs)
|
||||
sensor[i].setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18);
|
||||
sensor[i].setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14);
|
||||
VL53L0X_device[i].setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18);
|
||||
VL53L0X_device[i].setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14);
|
||||
#endif
|
||||
#if defined VL53L0X_HIGH_SPEED
|
||||
// reduce timing budget to 20 ms (default is about 33 ms)
|
||||
sensor[i].setMeasurementTimingBudget(20000);
|
||||
VL53L0X_device[i].setMeasurementTimingBudget(20000);
|
||||
#elif defined VL53L0X_HIGH_ACCURACY
|
||||
// increase timing budget to 200 ms
|
||||
sensor[i].setMeasurementTimingBudget(200000);
|
||||
VL53L0X_device[i].setMeasurementTimingBudget(200000);
|
||||
#endif
|
||||
// Start continuous back-to-back mode (take readings as
|
||||
// fast as possible). To use continuous timed mode
|
||||
// instead, provide a desired inter-measurement period in
|
||||
// ms (e.g. sensor.startContinuous(100)).
|
||||
sensor[i].startContinuous();
|
||||
VL53L0X_device[i].startContinuous();
|
||||
|
||||
Vl53l0x[i].ready = 1;
|
||||
Vl53l0x[i].index = 0;
|
||||
Vl53l0x_data[i].ready = 1;
|
||||
Vl53l0x_data[i].index = 0;
|
||||
VL53L0X_detected = true;
|
||||
if (!xshut) { break; }
|
||||
if (!VL53L0X_xshut) { break; }
|
||||
} else {
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_I2C D_SENSOR " VL53L0X %d - " D_FAILED_TO_START), i+1);
|
||||
}
|
||||
|
@ -140,24 +145,24 @@ void Vl53l0Detect(void) {
|
|||
}
|
||||
|
||||
void Vl53l0Every_250MSecond(void) {
|
||||
for (uint32_t i = 0; i < VL53L0X_MAX_SENSORS; i++) {
|
||||
if (PinUsed(GPIO_VL53L0X_XSHUT1, i) || (!xshut)) {
|
||||
uint16_t dist = sensor[i].readRangeContinuousMillimeters();
|
||||
for (uint32_t i = 0; i < VL53LXX_MAX_SENSORS; i++) {
|
||||
if (PinUsed(GPIO_VL53LXX_XSHUT1, i) || (!VL53L0X_xshut)) {
|
||||
uint16_t dist = VL53L0X_device[i].readRangeContinuousMillimeters();
|
||||
if ((0 == dist) || (dist > 2200)) {
|
||||
dist = 9999;
|
||||
}
|
||||
|
||||
#ifdef USE_VL_MEDIAN
|
||||
// store in ring buffer
|
||||
Vl53l0x[i].buffer[Vl53l0x[i].index] = dist;
|
||||
Vl53l0x[i].index++;
|
||||
if (Vl53l0x[i].index >= USE_VL_MEDIAN_SIZE) {
|
||||
Vl53l0x[i].index = 0;
|
||||
Vl53l0x_data[i].buffer[Vl53l0x_data[i].index] = dist;
|
||||
Vl53l0x_data[i].index++;
|
||||
if (Vl53l0x_data[i].index >= USE_VL_MEDIAN_SIZE) {
|
||||
Vl53l0x_data[i].index = 0;
|
||||
}
|
||||
|
||||
// sort list and take median
|
||||
uint16_t tbuff[USE_VL_MEDIAN_SIZE];
|
||||
memmove(tbuff, Vl53l0x[i].buffer, sizeof(tbuff));
|
||||
memmove(tbuff, Vl53l0x_data[i].buffer, sizeof(tbuff));
|
||||
uint16_t tmp;
|
||||
uint8_t flag;
|
||||
for (uint32_t ocnt = 0; ocnt < USE_VL_MEDIAN_SIZE; ocnt++) {
|
||||
|
@ -172,65 +177,65 @@ void Vl53l0Every_250MSecond(void) {
|
|||
}
|
||||
if (!flag) { break; }
|
||||
}
|
||||
Vl53l0x[i].distance = tbuff[(USE_VL_MEDIAN_SIZE -1) / 2];
|
||||
Vl53l0x_data[i].distance = tbuff[(USE_VL_MEDIAN_SIZE -1) / 2];
|
||||
#else
|
||||
Vl53l0x[i].distance = dist;
|
||||
Vl53l0x_data[i].distance = dist;
|
||||
#endif
|
||||
}
|
||||
if (!xshut) { break; }
|
||||
if (!VL53L0X_xshut) { break; }
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_DOMOTICZ
|
||||
void Vl53l0Every_Second(void) {
|
||||
if (abs(Vl53l0x[0].distance - Vl53l0x[0].distance_prev) > 8) {
|
||||
Vl53l0x[0].distance_prev = Vl53l0x[0].distance;
|
||||
DomoticzSensor(DZ_ILLUMINANCE, Vl53l0x[0].distance);
|
||||
if (abs(Vl53l0x_data[0].distance - Vl53l0x_data[0].distance_prev) > 8) {
|
||||
Vl53l0x_data[0].distance_prev = Vl53l0x_data[0].distance;
|
||||
DomoticzSensor(DZ_ILLUMINANCE, Vl53l0x_data[0].distance);
|
||||
}
|
||||
}
|
||||
#endif // USE_DOMOTICZ
|
||||
|
||||
void Vl53l0Show(boolean json) {
|
||||
for (uint32_t i = 0; i < VL53L0X_MAX_SENSORS; i++) {
|
||||
if (PinUsed(GPIO_VL53L0X_XSHUT1, i) || (!xshut)) {
|
||||
for (uint32_t i = 0; i < VL53LXX_MAX_SENSORS; i++) {
|
||||
if (PinUsed(GPIO_VL53LXX_XSHUT1, i) || (!VL53L0X_xshut)) {
|
||||
if (json) {
|
||||
if (Vl53l0x[i].distance == 9999) {
|
||||
if (xshut) {
|
||||
if (Vl53l0x_data[i].distance == 9999) {
|
||||
if (VL53L0X_xshut) {
|
||||
ResponseAppend_P(PSTR(",\"VL53L0X_%d\":{\"" D_JSON_DISTANCE "\":null}"), i+1);
|
||||
} else {
|
||||
ResponseAppend_P(PSTR(",\"VL53L0X\":{\"" D_JSON_DISTANCE "\":null}")); // For backwards compatibility when not using XSHUT GPIOs
|
||||
}
|
||||
} else {
|
||||
if (xshut) {
|
||||
ResponseAppend_P(PSTR(",\"VL53L0X_%d\":{\"" D_JSON_DISTANCE "\":%d}"), i+1, Vl53l0x[i].distance);
|
||||
if (VL53L0X_xshut) {
|
||||
ResponseAppend_P(PSTR(",\"VL53L0X_%d\":{\"" D_JSON_DISTANCE "\":%d}"), i+1, Vl53l0x_data[i].distance);
|
||||
} else {
|
||||
ResponseAppend_P(PSTR(",\"VL53L0X\":{\"" D_JSON_DISTANCE "\":%d}"), Vl53l0x[i].distance); // For backwards compatibility when not using XSHUT GPIOs
|
||||
ResponseAppend_P(PSTR(",\"VL53L0X\":{\"" D_JSON_DISTANCE "\":%d}"), Vl53l0x_data[i].distance); // For backwards compatibility when not using XSHUT GPIOs
|
||||
}
|
||||
}
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
if (Vl53l0x[i].distance == 9999) {
|
||||
if (xshut) {
|
||||
if (Vl53l0x_data[i].distance == 9999) {
|
||||
if (VL53L0X_xshut) {
|
||||
WSContentSend_PD("{s}%s_%d " D_DISTANCE "{m}%s {e}", PSTR("VL53L0X"), i+1, PSTR(D_OUT_OF_RANGE));
|
||||
} else {
|
||||
WSContentSend_PD("{s}%s " D_DISTANCE "{m}%s {e}", PSTR("VL53L0X"), PSTR(D_OUT_OF_RANGE)); // For backwards compatibility when not using XSHUT GPIOs
|
||||
}
|
||||
} else {
|
||||
if (xshut) {
|
||||
WSContentSend_PD("{s}%s_%d " D_DISTANCE "{m}%d " D_UNIT_MILLIMETER "{e}", PSTR("VL53L0X"), i+1, Vl53l0x[i].distance);
|
||||
if (VL53L0X_xshut) {
|
||||
WSContentSend_PD("{s}%s_%d " D_DISTANCE "{m}%d " D_UNIT_MILLIMETER "{e}", PSTR("VL53L0X"), i+1, Vl53l0x_data[i].distance);
|
||||
} else {
|
||||
WSContentSend_PD(HTTP_SNS_DISTANCE, PSTR("VL53L0X"), Vl53l0x[i].distance); // For backwards compatibility when not using XSHUT GPIOs
|
||||
WSContentSend_PD(HTTP_SNS_DISTANCE, PSTR("VL53L0X"), Vl53l0x_data[i].distance); // For backwards compatibility when not using XSHUT GPIOs
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (sensor[i].timeoutOccurred()) { AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_I2C D_TIMEOUT_WAITING_FOR D_SENSOR " VL53L0X %d"), i+1); }
|
||||
if (!xshut) { break; }
|
||||
if (VL53L0X_device[i].timeoutOccurred()) { AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_I2C D_TIMEOUT_WAITING_FOR D_SENSOR " VL53L0X %d"), i+1); }
|
||||
if (!VL53L0X_xshut) { break; }
|
||||
}
|
||||
#ifdef USE_DOMOTICZ
|
||||
if ((json) && (0 == TasmotaGlobal.tele_period)){
|
||||
DomoticzSensor(DZ_ILLUMINANCE, Vl53l0x[0].distance);
|
||||
DomoticzSensor(DZ_ILLUMINANCE, Vl53l0x_data[0].distance);
|
||||
}
|
||||
#endif // USE_DOMOTICZ
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
xsns_77_vl53l1x.ino - VL53L1X sensor support for Tasmota
|
||||
xsns_77_vl53l1x_device[0].ino - VL53L1X sensor support for Tasmota
|
||||
|
||||
Copyright (C) 2021 Theo Arends, Rui Marinho and Johann Obermeier
|
||||
|
||||
|
@ -25,64 +25,142 @@
|
|||
* Source:
|
||||
*
|
||||
* I2C Address: 0x29
|
||||
*********************************************************************************************
|
||||
*
|
||||
* Note: When using multiple VL53L0X, it is required to also wire the XSHUT pin of all those sensors
|
||||
* in order to let Tasmota change by software the I2C address of those and give them an unique address
|
||||
* for operation. The sensor don't save its address, so this procedure of changing its address is needed
|
||||
* to be performed every restart. The Addresses used for this are 120 (0x78) to 127 (0x7F). In the I2c
|
||||
* Standard (https://i2cdevices.org/addresses) those addresses are used by the PCA9685.
|
||||
* The base address (0x78) can be changed as a compile option with #define VL53L1X_XSHUT_ADDRESS 0xNN in
|
||||
* your user_config_override.h
|
||||
*
|
||||
* The default value of VL53LXX_MAX_SENSORS is set in the file tasmota.h
|
||||
* Changing that is backwards incompatible - Max supported devices by this driver are 8
|
||||
*********************************************************************************************
|
||||
* The following settings can be overriden
|
||||
*
|
||||
*
|
||||
\*********************************************************************************************/
|
||||
|
||||
#define XSNS_77 77
|
||||
#define XI2C_54 54 // See I2CDEVICES.md
|
||||
|
||||
#include "VL53L1X.h"
|
||||
VL53L1X vl53l1x = VL53L1X(); // create object copy
|
||||
|
||||
#define VL53L1X_ADDRESS 0x29
|
||||
#ifndef VL53L1X_XSHUT_ADDRESS
|
||||
#define VL53L1X_XSHUT_ADDRESS 0x78
|
||||
#endif
|
||||
|
||||
#ifndef VL53L1X_DISTANCE_MODE
|
||||
#define VL53L1X_DISTANCE_MODE Long
|
||||
#endif
|
||||
|
||||
VL53L1X vl53l1x_device[VL53LXX_MAX_SENSORS];
|
||||
|
||||
struct {
|
||||
uint16_t distance = 0;
|
||||
bool ready = false;
|
||||
} vl53l1x_sensors;
|
||||
} vl53l1x_data[VL53LXX_MAX_SENSORS];
|
||||
|
||||
uint8_t VL53L1X_xshut = 0;
|
||||
uint8_t VL53L1X_detected = 0;
|
||||
|
||||
/********************************************************************************************/
|
||||
|
||||
void Vl53l1Detect(void) {
|
||||
if (!I2cSetDevice(VL53L1X_ADDRESS)) { return; }
|
||||
if (!vl53l1x.init()) { return; }
|
||||
|
||||
I2cSetActiveFound(vl53l1x.getAddress(), "VL53L1X");
|
||||
vl53l1x.setTimeout(500);
|
||||
vl53l1x.setDistanceMode(VL53L1X::Long); // could be Short, Medium, Long
|
||||
vl53l1x.setMeasurementTimingBudget(140000);
|
||||
vl53l1x.startContinuous(50);
|
||||
vl53l1x_sensors.ready = true;
|
||||
uint32_t i, xshut;
|
||||
for (i = 0, xshut = 1 ; i < VL53LXX_MAX_SENSORS ; i++, xshut <<= 1) {
|
||||
if (PinUsed(GPIO_VL53LXX_XSHUT1, i)) {
|
||||
pinMode(Pin(GPIO_VL53LXX_XSHUT1, i), OUTPUT);
|
||||
digitalWrite(Pin(GPIO_VL53LXX_XSHUT1, i), 0);
|
||||
VL53L1X_xshut |= xshut;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0, xshut = 1 ; i < VL53LXX_MAX_SENSORS ; i++, xshut <<= 1) {
|
||||
if (xshut & VL53L1X_xshut) {
|
||||
digitalWrite(Pin(GPIO_VL53LXX_XSHUT1, i), 1);
|
||||
delay(2);
|
||||
}
|
||||
if (!I2cSetDevice(VL53L1X_ADDRESS) && !I2cSetDevice((uint8_t)(VL53L1X_XSHUT_ADDRESS+i))) { continue; } // Detection for unconfigured OR configured sensor
|
||||
if (vl53l1x_device[i].init()) {
|
||||
if (VL53L1X_xshut) {
|
||||
vl53l1x_device[i].setAddress((uint8_t)(VL53L1X_XSHUT_ADDRESS+i));
|
||||
}
|
||||
uint8_t addr = vl53l1x_device[i].getAddress();
|
||||
vl53l1x_device[i].setTimeout(500);
|
||||
vl53l1x_device[i].setDistanceMode(VL53L1X::VL53L1X_DISTANCE_MODE); // could be Short, Medium, Long
|
||||
vl53l1x_device[i].setMeasurementTimingBudget(140000);
|
||||
vl53l1x_device[i].startContinuous(50);
|
||||
VL53L1X_detected |= xshut;
|
||||
|
||||
if (VL53L1X_xshut) {
|
||||
I2cSetActive(addr);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_I2C D_SENSOR " VL53L1X-%d " D_SENSOR_DETECTED " - " D_NEW_ADDRESS " 0x%02X"), i+1, addr);
|
||||
} else {
|
||||
I2cSetActiveFound(addr, "VL53L1X");
|
||||
}
|
||||
} // if init
|
||||
if (0 == VL53L1X_xshut) break;
|
||||
} // for
|
||||
}
|
||||
|
||||
void Vl53l1Every_250MSecond(void) {
|
||||
uint16_t dist = vl53l1x.read();
|
||||
if (!dist || dist > 4000) {
|
||||
dist = 9999;
|
||||
}
|
||||
vl53l1x_sensors.distance = dist;
|
||||
uint32_t i, xshut;
|
||||
for (i = 0, xshut = 1; i < VL53LXX_MAX_SENSORS; i++, xshut <<= 1) {
|
||||
if (xshut & VL53L1X_detected) {
|
||||
uint16_t dist = vl53l1x_device[i].read();
|
||||
if (!dist || dist > 4000) {
|
||||
dist = 9999;
|
||||
}
|
||||
vl53l1x_data[i].distance = dist;
|
||||
} // if detected
|
||||
if (0 == VL53L1X_xshut) break;
|
||||
} // for
|
||||
}
|
||||
|
||||
#ifdef USE_DOMOTICZ
|
||||
void Vl53l1Every_Second(void) {
|
||||
char distance[FLOATSZ];
|
||||
dtostrfd((float)vl53l1x_sensors.distance / 10, 1, distance);
|
||||
dtostrfd((float)vl53l1x_data[0].distance / 10, 1, distance);
|
||||
DomoticzSensor(DZ_ILLUMINANCE, distance);
|
||||
}
|
||||
#endif // USE_DOMOTICZ
|
||||
|
||||
void Vl53l1Show(bool json) {
|
||||
if (json) {
|
||||
ResponseAppend_P(PSTR(",\"VL53L1X\":{\"" D_JSON_DISTANCE "\":%d}"), vl53l1x_sensors.distance);
|
||||
uint32_t i, xshut;
|
||||
for (i = 0, xshut = 1 ; i < VL53LXX_MAX_SENSORS ; i++, xshut <<= 1) {
|
||||
if (xshut & VL53L1X_detected) {
|
||||
if (json) {
|
||||
if (0 == VL53L1X_xshut) {
|
||||
ResponseAppend_P(PSTR(",\"VL53L1X\":{\"" D_JSON_DISTANCE "\":%d}"), vl53l1x_data[i].distance);
|
||||
}
|
||||
else {
|
||||
ResponseAppend_P(PSTR(",\"VL53L1X%c%d\":{\"" D_JSON_DISTANCE "\":%d}"), IndexSeparator(), i+1, vl53l1x_data[i].distance);
|
||||
}
|
||||
#ifdef USE_DOMOTICZ
|
||||
if (0 == TasmotaGlobal.tele_period) {
|
||||
Vl53l1Every_Second();
|
||||
}
|
||||
if (0 == TasmotaGlobal.tele_period) {
|
||||
Vl53l1Every_Second();
|
||||
}
|
||||
#endif // USE_DOMOTICZ
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
WSContentSend_PD(HTTP_SNS_DISTANCE, PSTR("VL53L1X"), vl53l1x_sensors.distance);
|
||||
}
|
||||
else {
|
||||
if (0 == VL53L1X_xshut) {
|
||||
WSContentSend_PD(HTTP_SNS_DISTANCE, PSTR("VL53L1X"), vl53l1x_data[i].distance);
|
||||
}
|
||||
else {
|
||||
char tmpstr[12];
|
||||
sprintf(tmpstr, PSTR("VL53L1X%c%d"), IndexSeparator(), i+1);
|
||||
WSContentSend_PD(HTTP_SNS_DISTANCE, tmpstr, vl53l1x_data[i].distance);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} // if detected
|
||||
if (0 == VL53L1X_xshut) break;
|
||||
} // for
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
|
@ -97,7 +175,7 @@ bool Xsns77(uint8_t function) {
|
|||
if (FUNC_INIT == function) {
|
||||
Vl53l1Detect();
|
||||
}
|
||||
else if (vl53l1x_sensors.ready) {
|
||||
else if (VL53L1X_detected) {
|
||||
switch (function) {
|
||||
case FUNC_EVERY_250_MSECOND:
|
||||
Vl53l1Every_250MSecond();
|
||||
|
|
|
@ -251,7 +251,7 @@ SSD1351_DC = GPIO_SSD1351_DC
|
|||
XPT2046_CS = GPIO_XPT2046_CS
|
||||
CSE7761_TX = GPIO_CSE7761_TX
|
||||
CSE7761_RX = GPIO_CSE7761_RX
|
||||
VL53L0X_XSHUT1 = GPIO_VL53L0X_XSHUT1
|
||||
VL53LXX_XSHUT1 = GPIO_VL53LXX_XSHUT1
|
||||
MAX7219CLK = GPIO_MAX7219CLK
|
||||
MAX7219DIN = GPIO_MAX7219DIN
|
||||
MAX7219CS = GPIO_MAX7219CS
|
||||
|
|
Loading…
Reference in New Issue