diff --git a/tasmota/language/af_AF.h b/tasmota/language/af_AF.h
index b445d8dcd..b61c82c6e 100644
--- a/tasmota/language/af_AF.h
+++ b/tasmota/language/af_AF.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v9.2.0.4
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/bg_BG.h b/tasmota/language/bg_BG.h
index c9ddf4cbf..2061eb460 100644
--- a/tasmota/language/bg_BG.h
+++ b/tasmota/language/bg_BG.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v8.2.0.6
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -796,7 +796,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/cs_CZ.h b/tasmota/language/cs_CZ.h
index 6bd44919c..be329c3e2 100644
--- a/tasmota/language/cs_CZ.h
+++ b/tasmota/language/cs_CZ.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v6.5.0.9
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/de_DE.h b/tasmota/language/de_DE.h
index c7221243b..9eaff2441 100644
--- a/tasmota/language/de_DE.h
+++ b/tasmota/language/de_DE.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v9.2.0.3
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/el_GR.h b/tasmota/language/el_GR.h
index e11ae5194..ca14da7c1 100644
--- a/tasmota/language/el_GR.h
+++ b/tasmota/language/el_GR.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v6.5.0
+ * Updated until v9.3.1.1
\*********************************************************************/
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/en_GB.h b/tasmota/language/en_GB.h
index df99b6504..12a476a32 100644
--- a/tasmota/language/en_GB.h
+++ b/tasmota/language/en_GB.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v8.0.0.0
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/es_ES.h b/tasmota/language/es_ES.h
index b05540083..93967a818 100644
--- a/tasmota/language/es_ES.h
+++ b/tasmota/language/es_ES.h
@@ -1,5 +1,5 @@
/*
- es-ES.h - localization for Spanish - Spain for Tasmota
+ es-ES.h - localization for Spanish - Spain for Tasmota (translation also valid for all latinamerica)
Copyright (C) 2021 Adrian Scillato
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v9.2.0.3
+ * Updated until v9.3.1.1
\*********************************************************************/
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Cambiando dirección a"
+#define D_OUT_OF_RANGE "Fuera de Rango"
+#define D_SENSOR_DETECTED "detectado"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/fr_FR.h b/tasmota/language/fr_FR.h
index a5c8ab250..980b380f7 100644
--- a/tasmota/language/fr_FR.h
+++ b/tasmota/language/fr_FR.h
@@ -1,14 +1,18 @@
/*
fr-FR.h - localization for French - France for Tasmota
+
Copyright (C) 2021 Olivier Francais
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
+
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
@@ -24,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v9.2.0.3
+ * Updated until v9.3.1.1
\*********************************************************************/
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -793,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/fy_NL.h b/tasmota/language/fy_NL.h
index bb33ebc2d..8b166dd94 100644
--- a/tasmota/language/fy_NL.h
+++ b/tasmota/language/fy_NL.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v9.2.0.4
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/he_HE.h b/tasmota/language/he_HE.h
index 1d5785433..8bf5e5e97 100644
--- a/tasmota/language/he_HE.h
+++ b/tasmota/language/he_HE.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v5.14.0b
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/hu_HU.h b/tasmota/language/hu_HU.h
index 6baf1960f..239239348 100644
--- a/tasmota/language/hu_HU.h
+++ b/tasmota/language/hu_HU.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v5.12.0e
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/it_IT.h b/tasmota/language/it_IT.h
index 3540c0cb0..c2251af85 100644
--- a/tasmota/language/it_IT.h
+++ b/tasmota/language/it_IT.h
@@ -1,7 +1,7 @@
/*
it-IT.h - localization for Italian - Italy for Tasmota
- Copyright (C) 2021 Gennaro Tortone - some mods by Antonio Fragola - Updated by bovirus - rev. 03.03.2021
+ Copyright (C) 2021 Gennaro Tortone, Antonio Fragola, Bovirus and Adrian Scillato
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v6.0.0a
+ * Updated until v9.3.1.1
\*********************************************************************/
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,6 +797,10 @@
#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_NEW_ADDRESS "Cambio di indirizzo a"
+#define D_OUT_OF_RANGE "Fuori dal limite"
+#define D_SENSOR_DETECTED "rilevato"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/ko_KO.h b/tasmota/language/ko_KO.h
index 907f840e5..964ab46a7 100644
--- a/tasmota/language/ko_KO.h
+++ b/tasmota/language/ko_KO.h
@@ -1,7 +1,7 @@
/*
ko-KO.h - localization for Korean - Korean for Tasmota
- Copyright (C) 2021 Theo Arends (translated by NyaamZ)
+ Copyright (C) 2021 NyaamZ
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v6.2.1.11
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/nl_NL.h b/tasmota/language/nl_NL.h
index 96991391f..bc855e4a8 100644
--- a/tasmota/language/nl_NL.h
+++ b/tasmota/language/nl_NL.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v9.2.0.4
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/pl_PL.h b/tasmota/language/pl_PL.h
index 818aba4cb..78710996f 100644
--- a/tasmota/language/pl_PL.h
+++ b/tasmota/language/pl_PL.h
@@ -1,7 +1,7 @@
/*
pl-PL-d.h - localization for Polish with diacritics - Poland for Tasmota
- Copyright (C) 2021 Theo Arends (translated by roblad - Robert L., upgraded by R. Turala)
+ Copyright (C) 2021 Roblad (Robert L.) and R. Turala
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v5.12.0d
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/pt_BR.h b/tasmota/language/pt_BR.h
index c9ba30c50..a2929b529 100644
--- a/tasmota/language/pt_BR.h
+++ b/tasmota/language/pt_BR.h
@@ -1,7 +1,7 @@
/*
pt-BR.h - localization for Portuguese - Brazil for Tasmota
- Copyright (C) 2021 Fabiano Bovo
+ Copyright (C) 2021 Fabiano Bovo and Adrian Scillato
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v7.0.0.1
+ * Updated until v9.3.1.1
\*********************************************************************/
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Mudança de endereço para"
+#define D_OUT_OF_RANGE "Fora de Alcance"
+#define D_SENSOR_DETECTED "detectou"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/pt_PT.h b/tasmota/language/pt_PT.h
index 0687aedcd..c5b524875 100644
--- a/tasmota/language/pt_PT.h
+++ b/tasmota/language/pt_PT.h
@@ -1,7 +1,7 @@
/*
pt-PT.h - localization for Portuguese - Portugal for Tasmota
- Copyright (C) 2021 Paulo Paiva
+ Copyright (C) 2021 Paulo Paiva and Adrian Scillato
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v7.0.0.1
+ * Updated until v9.3.1.1
\*********************************************************************/
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Mudança de endereço para"
+#define D_OUT_OF_RANGE "Fora de Alcance"
+#define D_SENSOR_DETECTED "detectou"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/ro_RO.h b/tasmota/language/ro_RO.h
index d9d779948..c8182eb75 100644
--- a/tasmota/language/ro_RO.h
+++ b/tasmota/language/ro_RO.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v8.1.0.10
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/ru_RU.h b/tasmota/language/ru_RU.h
index ab546c0f1..6d8d0b932 100644
--- a/tasmota/language/ru_RU.h
+++ b/tasmota/language/ru_RU.h
@@ -1,7 +1,7 @@
/*
- ru-RU.h - localization for Russian - Rissia for Tasmota
+ ru-RU.h - localization for Russian - Russia for Tasmota
- Copyright (C) 2021 Theo Arends / roman-vn
+ Copyright (C) 2021 Roman-vn
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v5.12.0b
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "А"
diff --git a/tasmota/language/sk_SK.h b/tasmota/language/sk_SK.h
index 9310a6d24..b0fbc5c3f 100644
--- a/tasmota/language/sk_SK.h
+++ b/tasmota/language/sk_SK.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v6.2.1.14
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/sv_SE.h b/tasmota/language/sv_SE.h
index 67de1e2aa..5ccbc77fe 100644
--- a/tasmota/language/sv_SE.h
+++ b/tasmota/language/sv_SE.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v6.2.1.11
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/tr_TR.h b/tasmota/language/tr_TR.h
index b21b0574a..e6429fed1 100644
--- a/tasmota/language/tr_TR.h
+++ b/tasmota/language/tr_TR.h
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v6.1.1
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/uk_UA.h b/tasmota/language/uk_UA.h
index b1baca8dd..286b851dc 100644
--- a/tasmota/language/uk_UA.h
+++ b/tasmota/language/uk_UA.h
@@ -1,7 +1,7 @@
/*
uk-UA.h - localization for Ukrainian - Ukraine for Tasmota
- Copyright (C) 2021 Theo Arends / vadym-adik
+ Copyright (C) 2021 Vadym-adik
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v5.14.0a
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "А"
diff --git a/tasmota/language/vi_VN.h b/tasmota/language/vi_VN.h
index 40ea941d0..c04e43010 100644
--- a/tasmota/language/vi_VN.h
+++ b/tasmota/language/vi_VN.h
@@ -1,7 +1,7 @@
/*
vi-VN.h - localization for Vietnam for Tasmota
- Copyright (C) 2021 translateb by Tâm.NT
+ Copyright (C) 2021 Tâm.NT
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v9.0.0.1
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "A"
diff --git a/tasmota/language/zh_CN.h b/tasmota/language/zh_CN.h
index 73f9424ed..a7e1847ca 100644
--- a/tasmota/language/zh_CN.h
+++ b/tasmota/language/zh_CN.h
@@ -1,7 +1,7 @@
/*
zh-CN.h - localization for Chinese (Simplified) - China for Tasmota
- Copyright (C) 2021 Theo Arends (translated by killadm)
+ Copyright (C) 2021 Killadm
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v5.14.0b
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "安"
diff --git a/tasmota/language/zh_TW.h b/tasmota/language/zh_TW.h
index 8a759f0eb..13cc6e858 100644
--- a/tasmota/language/zh_TW.h
+++ b/tasmota/language/zh_TW.h
@@ -1,7 +1,7 @@
/*
zh-TW.h - localization for Chinese (Traditional) - Taiwan for Tasmota
- Copyright (C) 2021 Theo Arends (translated by dannydu)
+ Copyright (C) 2021 Dannydu
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
- * Updated until v5.12.0d
+ * Updated until v9.3.1.1
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@@ -797,7 +797,10 @@
#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_NEW_ADDRESS "Setting address to"
+#define D_OUT_OF_RANGE "Out of Range"
+#define D_SENSOR_DETECTED "detected"
// Units
#define D_UNIT_AMPERE "安培"
diff --git a/tasmota/settings.h b/tasmota/settings.h
index 25b0145da..7dd8dbc29 100644
--- a/tasmota/settings.h
+++ b/tasmota/settings.h
@@ -149,7 +149,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t mqtt_state_retain : 1; // bit 7 (v9.3.0.1) - CMND_STATERETAIN
uint32_t mqtt_info_retain : 1; // bit 8 (v9.3.0.1) - CMND_INFORETAIN
uint32_t wiegand_hex_output : 1; // bit 9 (v9.3.1.1) - SetOption123 - (Wiegand) switch tag number output to hex format (1)
- uint32_t spare10 : 1; // bit 10
+ uint32_t wiegand_keypad_to_tag : 1; // bit 10 (v9.3.1.1) - SetOption124 - (Wiegand) send key pad stroke as single char (0) or one tag (ending char #) (1)
uint32_t spare11 : 1; // bit 11
uint32_t spare12 : 1; // bit 12
uint32_t spare13 : 1; // bit 13
diff --git a/tasmota/tasmota.h b/tasmota/tasmota.h
index 87e5f01b3..3191036e3 100644
--- a/tasmota/tasmota.h
+++ b/tasmota/tasmota.h
@@ -83,6 +83,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
#ifdef ESP32
const uint8_t MAX_I2C = 2; // Max number of I2C controllers (ESP32 = 2)
diff --git a/tasmota/tasmota_template.h b/tasmota/tasmota_template.h
index e034fb8d1..9d24d78be 100644
--- a/tasmota/tasmota_template.h
+++ b/tasmota/tasmota_template.h
@@ -154,6 +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_SENSOR_END };
enum ProgramSelectablePins {
@@ -328,6 +329,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 "|"
;
const char kSensorNamesFixed[] PROGMEM =
@@ -784,6 +786,10 @@ 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.
+#endif
+
/*-------------------------------------------------------------------------------------------*\
* ESP32 specifics
\*-------------------------------------------------------------------------------------------*/
diff --git a/tasmota/xsns_29_mcp230xx.ino b/tasmota/xsns_29_mcp230xx.ino
index 3e4dd9dee..c1e7a08bb 100644
--- a/tasmota/xsns_29_mcp230xx.ino
+++ b/tasmota/xsns_29_mcp230xx.ino
@@ -45,7 +45,7 @@ uint8_t MCP230xx_GPIO = 0x09;
uint8_t mcp230xx_type = 0;
uint8_t mcp230xx_pincount = 0;
-uint8_t mcp230xx_oldoutpincount = 0;
+uint8_t mcp230xx_outpincount = 0;
#ifdef USE_MCP230xx_OUTPUT
uint8_t mcp230xx_outpinmapping[16];
#endif
@@ -146,6 +146,18 @@ uint8_t MCP230xx_readGPIO(uint8_t port) {
void MCP230xx_ApplySettings(void)
{
+#ifdef USE_MCP230xx_OUTPUT
+ TasmotaGlobal.devices_present -= mcp230xx_outpincount;
+ mcp230xx_outpincount = 0;
+ for (uint32_t idx = 0; idx < mcp230xx_pincount; idx++) {
+ if (Settings.mcp230xx_config[idx].pinmode >= 5) {
+ mcp230xx_outpinmapping[mcp230xx_outpincount] = idx;
+ mcp230xx_outpincount++;
+ }
+ int_millis[idx]=millis();
+ }
+ TasmotaGlobal.devices_present += mcp230xx_outpincount;
+#endif // USE_MCP230xx_OUTPUT
uint8_t int_en = 0;
for (uint32_t mcp230xx_port = 0; mcp230xx_port < mcp230xx_type; mcp230xx_port++) {
uint8_t reg_gppu = 0;
@@ -191,23 +203,17 @@ void MCP230xx_ApplySettings(void)
}
I2cWrite8(USE_MCP230xx_ADDR, MCP230xx_GPPU+mcp230xx_port, reg_gppu);
I2cWrite8(USE_MCP230xx_ADDR, MCP230xx_GPINTEN+mcp230xx_port, reg_gpinten);
+#ifdef USE_MCP230xx_OUTPUT
I2cWrite8(USE_MCP230xx_ADDR, MCP230xx_IODIR+mcp230xx_port, reg_iodir);
-#ifdef USE_MCP230xx_OUTPUT
- I2cWrite8(USE_MCP230xx_ADDR, MCP230xx_GPIO+mcp230xx_port, reg_portpins);
-#endif // USE_MCP230xx_OUTPUT
- }
-#ifdef USE_MCP230xx_OUTPUT
- TasmotaGlobal.devices_present -= mcp230xx_oldoutpincount;
- mcp230xx_oldoutpincount = 0;
- for (uint32_t idx=0;idx= 5) {
- mcp230xx_outpinmapping[mcp230xx_oldoutpincount] = idx;
- mcp230xx_oldoutpincount++;
+ for (uint32_t idx = 0; idx < mcp230xx_outpincount; idx++) {
+ if (mcp230xx_port ? mcp230xx_outpinmapping[idx] > 7 : mcp230xx_outpinmapping[idx] < 8) {
+ uint8_t relay_no = TasmotaGlobal.devices_present - mcp230xx_outpincount + idx + 1;
+ ExecuteCommandPower(relay_no, (reg_portpins >> (mcp230xx_outpinmapping[idx] & 7)) & 1, SRC_IGNORE);
+ }
}
- int_millis[idx]=millis();
- }
- TasmotaGlobal.devices_present += mcp230xx_oldoutpincount;
+ //I2cWrite8(USE_MCP230xx_ADDR, MCP230xx_GPIO+mcp230xx_port, reg_portpins);
#endif // USE_MCP230xx_OUTPUT
+ }
mcp230xx_int_en = int_en;
MCP230xx_CheckForIntCounter(); // update register on whether or not we should be counting interrupts
MCP230xx_CheckForIntRetainer(); // update register on whether or not we should be retaining interrupt events for teleperiod
@@ -651,7 +657,7 @@ bool MCP230xx_Command(void)
for (relay_no = 0; relay_no < mcp230xx_pincount ; relay_no ++) {
if ( mcp230xx_outpinmapping[relay_no] == pin) break;
}
- relay_no = TasmotaGlobal.devices_present - mcp230xx_oldoutpincount + relay_no +1;
+ relay_no = TasmotaGlobal.devices_present - mcp230xx_outpincount + relay_no +1;
if ((!strcmp(ArgV(argument, 2), "ON")) || (!strcmp(ArgV(argument, 2), "1"))) {
ExecuteCommandPower(relay_no, 1, SRC_IGNORE);
return serviced;
@@ -799,8 +805,8 @@ void MCP230xx_Interrupt_Retain_Report(void) {
#ifdef USE_MCP230xx_OUTPUT
void MCP230xx_SwitchRelay() {
- for (uint32_t i = TasmotaGlobal.devices_present - mcp230xx_oldoutpincount; i < TasmotaGlobal.devices_present; i++) {
- uint8_t pin = mcp230xx_outpinmapping[i - (TasmotaGlobal.devices_present - mcp230xx_oldoutpincount)];
+ for (uint32_t i = TasmotaGlobal.devices_present - mcp230xx_outpincount; i < TasmotaGlobal.devices_present; i++) {
+ uint8_t pin = mcp230xx_outpinmapping[i - (TasmotaGlobal.devices_present - mcp230xx_outpincount)];
uint8_t pincmd = Settings.mcp230xx_config[pin].pinmode - 5;
uint8_t relay_state = bitRead(XdrvMailbox.index, i);
AddLog(LOG_LEVEL_DEBUG, PSTR("MCP: relay %d pin_no %d state %d"), i,pin, relay_state);
@@ -826,7 +832,7 @@ bool Xsns29(uint8_t function)
bool result = false;
- if (FUNC_PRE_INIT == function) {
+ if (FUNC_INIT == function) {
MCP230xx_Detect();
}
else if (mcp230xx_type) {
diff --git a/tasmota/xsns_45_vl53l0x.ino b/tasmota/xsns_45_vl53l0x.ino
index 1d377bd6d..3996f1c8e 100644
--- a/tasmota/xsns_45_vl53l0x.ino
+++ b/tasmota/xsns_45_vl53l0x.ino
@@ -1,7 +1,7 @@
/*
- xsns_45_vl53l0x.ino - VL53L0X time of flight sensor support for Tasmota
+ xsns_45_vl53l0x.ino - VL53L0X time of flight multiple sensors support for Tasmota
- Copyright (C) 2021 Theo Arends and Gerhard Mutz
+ Copyright (C) 2021 Theo Arends, Gerhard Mutz and Adrian Scillato
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,105 +23,216 @@
* VL53L0x time of flight sensor
*
* I2C Addres: 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, so take into
+ * account they won't work together.
+ *
+ * The default value of VL53L0X_MAX_SENSORS is set in the file tasmota.h
+ * Changing that is backwards incompatible - Max supported devices by this driver are 8
+ *
+ **********************************************************************************************
+ *
+ * How to install this sensor: https://www.st.com/resource/en/datasheet/vl53l0x.pdf
+ *
+ * If you are going to use long I2C wires read this:
+ * https://hackaday.com/2017/02/08/taking-the-leap-off-board-an-introduction-to-i2c-over-long-wires/
+ *
\*********************************************************************************************/
#define XSNS_45 45
#define XI2C_31 31 // See I2CDEVICES.md
+// Uncomment this line to use long range mode. This
+// increases the sensitivity of the sensor and extends its
+// potential range, but increases the likelihood of getting
+// an inaccurate reading because of reflections from objects
+// other than the intended target. It works best in dark
+// conditions.
+
+//#define VL53L0X_LONG_RANGE
+
+// Uncomment ONE of these two lines to get
+// - higher speed at the cost of lower accuracy OR
+// - higher accuracy at the cost of lower speed
+
+//#define VL53L0X_HIGH_SPEED
+//#define VL53L0X_HIGH_ACCURACY
+
#define USE_VL_MEDIAN
#define USE_VL_MEDIAN_SIZE 5 // Odd number of samples median detection
#include
#include "VL53L0X.h"
-VL53L0X sensor;
+VL53L0X sensor[VL53L0X_MAX_SENSORS];
struct {
uint16_t distance;
uint16_t distance_prev;
uint16_t buffer[5];
uint8_t ready = 0;
uint8_t index;
-} Vl53l0x;
+} Vl53l0x[VL53L0X_MAX_SENSORS];
+
+bool xshut = false;
+bool VL53L0X_detected = false;
/********************************************************************************************/
void Vl53l0Detect(void) {
- if (!I2cSetDevice(0x29)) { return; }
- if (!sensor.init()) { return; }
- I2cSetActiveFound(sensor.getAddress(), "VL53L0X");
+ 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;
+ }
+ }
- sensor.setTimeout(500);
+ 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) {
+ 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);
- // 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.startContinuous();
- Vl53l0x.ready = 1;
+#if defined VL53L0X_LONG_RANGE
+ // lower the return signal rate limit (default is 0.25 MCPS)
+ sensor[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);
+#endif
+#if defined VL53L0X_HIGH_SPEED
+ // reduce timing budget to 20 ms (default is about 33 ms)
+ sensor[i].setMeasurementTimingBudget(20000);
+#elif defined VL53L0X_HIGH_ACCURACY
+ // increase timing budget to 200 ms
+ sensor[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.index = 0;
+ Vl53l0x[i].ready = 1;
+ Vl53l0x[i].index = 0;
+ VL53L0X_detected = true;
+ if (!xshut) { break; }
+ } else {
+ AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_I2C D_SENSOR " VL53L0X %d - " D_FAILED_TO_START), i+1);
+ }
+ }
+ }
}
void Vl53l0Every_250MSecond(void) {
- uint16_t dist = sensor.readRangeContinuousMillimeters();
- if ((0 == dist) || (dist > 2000)) {
- dist = 9999;
- }
+ for (uint32_t i = 0; i < VL53L0X_MAX_SENSORS; i++) {
+ if (PinUsed(GPIO_VL53L0X_XSHUT1, i) || (!xshut)) {
+ uint16_t dist = sensor[i].readRangeContinuousMillimeters();
+ if ((0 == dist) || (dist > 2200)) {
+ dist = 9999;
+ }
#ifdef USE_VL_MEDIAN
- // store in ring buffer
- Vl53l0x.buffer[Vl53l0x.index] = dist;
- Vl53l0x.index++;
- if (Vl53l0x.index >= USE_VL_MEDIAN_SIZE) {
- Vl53l0x.index = 0;
- }
+ // 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;
+ }
- // sort list and take median
- uint16_t tbuff[USE_VL_MEDIAN_SIZE];
- memmove(tbuff, Vl53l0x.buffer, sizeof(tbuff));
- uint16_t tmp;
- uint8_t flag;
- for (uint32_t ocnt = 0; ocnt < USE_VL_MEDIAN_SIZE; ocnt++) {
- flag = 0;
- for (uint32_t count = 0; count < USE_VL_MEDIAN_SIZE -1; count++) {
- if (tbuff[count] > tbuff[count +1]) {
- tmp = tbuff[count];
- tbuff[count] = tbuff[count +1];
- tbuff[count +1] = tmp;
- flag = 1;
- }
- }
- if (!flag) { break; }
- }
- Vl53l0x.distance = tbuff[(USE_VL_MEDIAN_SIZE -1) / 2];
+ // sort list and take median
+ uint16_t tbuff[USE_VL_MEDIAN_SIZE];
+ memmove(tbuff, Vl53l0x[i].buffer, sizeof(tbuff));
+ uint16_t tmp;
+ uint8_t flag;
+ for (uint32_t ocnt = 0; ocnt < USE_VL_MEDIAN_SIZE; ocnt++) {
+ flag = 0;
+ for (uint32_t count = 0; count < USE_VL_MEDIAN_SIZE -1; count++) {
+ if (tbuff[count] > tbuff[count +1]) {
+ tmp = tbuff[count];
+ tbuff[count] = tbuff[count +1];
+ tbuff[count +1] = tmp;
+ flag = 1;
+ }
+ }
+ if (!flag) { break; }
+ }
+ Vl53l0x[i].distance = tbuff[(USE_VL_MEDIAN_SIZE -1) / 2];
#else
- Vl53l0x.distance = dist;
+ Vl53l0x[i].distance = dist;
#endif
+ }
+ if (!xshut) { break; }
+ }
}
#ifdef USE_DOMOTICZ
void Vl53l0Every_Second(void) {
- if (abs(Vl53l0x.distance - Vl53l0x.distance_prev) > 8) {
- Vl53l0x.distance_prev = Vl53l0x.distance;
- DomoticzSensor(DZ_ILLUMINANCE, Vl53l0x.distance);
+ if (abs(Vl53l0x[0].distance - Vl53l0x[0].distance_prev) > 8) {
+ Vl53l0x[0].distance_prev = Vl53l0x[0].distance;
+ DomoticzSensor(DZ_ILLUMINANCE, Vl53l0x[0].distance);
}
}
#endif // USE_DOMOTICZ
void Vl53l0Show(boolean json) {
- if (json) {
- ResponseAppend_P(PSTR(",\"VL53L0X\":{\"" D_JSON_DISTANCE "\":%d}"), Vl53l0x.distance);
+ for (uint32_t i = 0; i < VL53L0X_MAX_SENSORS; i++) {
+ if (PinUsed(GPIO_VL53L0X_XSHUT1, i) || (!xshut)) {
+ if (json) {
+ if (Vl53l0x[i].distance == 9999) {
+ if (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);
+ } else {
+ ResponseAppend_P(PSTR(",\"VL53L0X\":{\"" D_JSON_DISTANCE "\":%d}"), Vl53l0x[i].distance); // For backwards compatibility when not using XSHUT GPIOs
+ }
+ }
+#ifdef USE_WEBSERVER
+ } else {
+ if (Vl53l0x[i].distance == 9999) {
+ if (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);
+ } else {
+ WSContentSend_PD(HTTP_SNS_DISTANCE, PSTR("VL53L0X"), Vl53l0x[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; }
+ }
#ifdef USE_DOMOTICZ
- if (0 == TasmotaGlobal.tele_period) {
- DomoticzSensor(DZ_ILLUMINANCE, Vl53l0x.distance);
+ if ((json) && (0 == TasmotaGlobal.tele_period)){
+ DomoticzSensor(DZ_ILLUMINANCE, Vl53l0x[0].distance);
}
#endif // USE_DOMOTICZ
-#ifdef USE_WEBSERVER
- } else {
- WSContentSend_PD(HTTP_SNS_DISTANCE, PSTR("VL53L0X"), Vl53l0x.distance);
-#endif
- }
}
/*********************************************************************************************\
@@ -136,7 +247,7 @@ bool Xsns45(byte function) {
if (FUNC_INIT == function) {
Vl53l0Detect();
}
- else if (Vl53l0x.ready) {
+ else if (VL53L0X_detected) {
switch (function) {
case FUNC_EVERY_250_MSECOND:
Vl53l0Every_250MSecond();
diff --git a/tasmota/xsns_82_wiegand.ino b/tasmota/xsns_82_wiegand.ino
index 4fff9c5d1..70f87b9c8 100644
--- a/tasmota/xsns_82_wiegand.ino
+++ b/tasmota/xsns_82_wiegand.ino
@@ -41,29 +41,47 @@
* - fix for #11047 Wiegand 26/34 missed some key press if they are press at normal speed
* - removed testing code for tests without attached hardware
* - added SetOption123 0-Wiegand UID decimal (default) 1-Wiegand UID hexadecimal
- * - added SetOption124 0-Keypad every key a single tag (default) 1-all keys up to ending char (#) send as one tag
+ * - added SetOption124 0-all keys up to ending char (# or *) send as one tag by MQTT (default) 1-Keypad every key a single tag
+ * - added a new realtime testing option emulating a Wiegang reader output on same GPIOs where normally reader is attached. Details below
\*********************************************************************************************/
-#warning **** Wiegand interface enabled ****
+#pragma message("**** Wiegand interface enabled ****")
#define XSNS_82 82
#define WIEGAND_CODE_GAP_FACTOR 3 // Gap between 2 complete RFID codes send by the device. (WIEGAND_CODE_GAP_FACTOR * bitTime) to detect the end of a code
-#define WIEGAND_BIT_TIME_DEFAULT 1250 // period time of one bit (impluse + impulse_gap time) 1250µs measured by oscilloscope on my RFID Reader
-#define WIEGAND_RFID_ARRAY_SIZE 5 // storage of rfids found between 2 calls of FUNC_EVERY_100_MSECOND
+#define WIEGAND_BIT_TIME_DEFAULT 1250 // period time (µs) of one bit (impluse + impulse_gap time) 1250µs measured by oscilloscope on my RFID Reader
+#define WIEGAND_RFID_ARRAY_SIZE 11 // storage of rfids found between 2 calls of FUNC_EVERY_100_MSECOND
#define WIEGAND_OPTION_HEX 123 // Index of option to switch output between hex (1) an decimal (0) (default)
+#define WIEGAND_OPTION_HEX_POSTFIX "h" // will be added after UID output nothing = ""
+#define WIEGAND_OPTION_KEYPAD_TO_TAG 124 //Index of option to switch output of key pad strokes between every single stroke one single char (0) (default)
+ // or all strokes until detecting ending char (WIEGAND_OPTION_KEYPAD_END_CHAR) as one tag (1)
-// using #define will save some space in the final code
-// DEV_WIEGAND_TEST_MODE 2 : testing with hardware correctly connected.
#define DEV_WIEGAND_TEST_MODE 0
+// using #define will save some space in the final code
+// DEV_WIEGAND_TEST_MODE 1 : Use only without Wiegand reader device attache. On a second ESP to simulate reader output!
+// DEV_WIEGAND_TEST_MODE 2 : testing with hardware correctly connected.
#ifdef DEV_WIEGAND_TEST_MODE
#if (DEV_WIEGAND_TEST_MODE==0)
#elif (DEV_WIEGAND_TEST_MODE==1)
- #warning "(no longer available) Wiegand Interface compiled with 'DEV_WIEGAND_TEST_MODE' 1 (Random RFID)"
+ #pragma message("\nWiegand Interface code generator (testing purpose only!) compiled with 'DEV_WIEGAND_TEST_MODE' 1 \nUse only on esp WITHOUT Wiegand reader hardware attached! GPIOS will be configured as OUTPUT!" )
+ // use on own risk for testing purpose only.
+ // please don't attach your reader to the ESP when you use this option. The GPIOS will be defined as OUTPUT
+ // the interrupts will be enabled and normally recognize the generated code, that's the idea behind for testing.
+ // Commands:
+ // WieBitTime [time] : get or set the bit impuls length
+ // WieInterBitTime [time]: get or set the length of the gap between 2 bits
+ // WieTagGap [tagGap]: get or set the current used gap time between 2 tags send in µs minimal WIEGAND_BIT_TIME_DEFAULT µs default WIEGAND_BIT_TIME_DEFAULT * WIEGAND_CODE_GAP_FACTOR
+ // WieTagSize [tagsize]: get or set the tagsize (4,8,24,26,32,34) default 26.
+ // WieTag [tag]: get or set the current used tag. For tagsize 4,8 only one char will be used.
+ // WieSend [tag[:tagsize];tag[:tagsize];...] : Generate the current Tag with current TagSize to GPIOs if the paramters are used
+ // tags and tagsize from commandline are used as current values. If tagsize is omitted always last value will be used
+ // WieSend 4:4;5:8; will send 4 in 4 bit mode and 5 in 8 bit mode with a pause of current TagGab between the chars
+ // WieSend will send the last used tag with last used tagsize
#elif (DEV_WIEGAND_TEST_MODE==2)
- #warning "Wiegand Interface compiled with 'DEV_WIEGAND_TEST_MODE' 2 (Hardware connected)"
+ #pragma message("\nWiegand Interface compiled with 'DEV_WIEGAND_TEST_MODE' 2 (Hardware connected)")
#else
- #warning "Wiegand Interface compiled with unknown mode"
+ #pragma message("\nWiegand Interface compiled with unknown mode")
#endif
#endif
@@ -71,7 +89,6 @@ typedef struct rfid_store { uint64_t RFID; uint16_t bitCount; } RFID_store;
class Wiegand {
public:
-
Wiegand(void);
void Init(void);
void ScanForTag(void);
@@ -81,21 +98,24 @@ class Wiegand {
bool isInit = false;
- private:
- //uint64_t HexStringToDec(uint64_t);
+ #if (DEV_WIEGAND_TEST_MODE!=1)
+ private:
+ #endif //(DEV_WIEGAND_TEST_MODE==1)
uint64_t CheckAndConvertRfid(uint64_t,uint16_t);
- char translateEnterEscapeKeyPress(char);
uint8_t CalculateParities(uint64_t, int);
bool WiegandConversion (uint64_t , uint16_t );
void setOutputFormat(void); // fix output HEX format
+ void HandleKeyPad(void); //handle one tag for multi key strokes
static void handleD0Interrupt(void);
static void handleD1Interrupt(void);
static void handleDxInterrupt(int in); // fix #11047
uint64_t rfid;
- uint8_t tagSize;
- char outFormat;
+ uint32_t tagSize;
+ const char* outFormat;
+ uint64_t mqttRFIDKeypadBuffer;
+ uint64_t webRFIDKeypadBuffer;
static volatile uint64_t rfidBuffer;
static volatile uint16_t bitCount;
@@ -107,7 +127,6 @@ class Wiegand {
static volatile bool CodeComplete;
static volatile RFID_store rfid_found[];
static volatile int currentFoundRFIDcount;
-
};
Wiegand* oWiegand = new Wiegand();
@@ -141,7 +160,9 @@ Wiegand::Wiegand() {
rfid_found[i].RFID=0;
rfid_found[i].bitCount=0;
}
- outFormat='u'; // standard output format decimal
+ outFormat="u"; // standard output format decimal
+ mqttRFIDKeypadBuffer = 0;
+ webRFIDKeypadBuffer = 0;
}
void ICACHE_RAM_ATTR Wiegand::handleD1Interrupt() { // Receive a 1 bit. (D0=high & D1=low)
@@ -202,6 +223,10 @@ void Wiegand::Init() {
#endif // DEV_WIEGAND_TEST_MODE>0
pinMode(Pin(GPIO_WIEGAND_D0), INPUT_PULLUP);
pinMode(Pin(GPIO_WIEGAND_D1), INPUT_PULLUP);
+#if (DEV_WIEGAND_TEST_MODE==1) // overwrite the setting
+ pinMode(Pin(GPIO_WIEGAND_D0), OUTPUT);
+ pinMode(Pin(GPIO_WIEGAND_D1), OUTPUT);
+#endif //(DEV_WIEGAND_TEST_MODE==1)
attachInterrupt(Pin(GPIO_WIEGAND_D0), handleD0Interrupt, FALLING);
attachInterrupt(Pin(GPIO_WIEGAND_D1), handleD1Interrupt, FALLING);
isInit = true; // Helps to run only if correctly setup
@@ -286,27 +311,8 @@ uint8_t Wiegand::CalculateParities(uint64_t tagWithoutParities, int tag_size=26)
return retValue;
}
-char Wiegand::translateEnterEscapeKeyPress(char oKeyPressed) {
- switch(oKeyPressed) {
- case 0x0b: // 11 or * key
- return 0x0d; // 13 or ASCII ENTER
-
- case 0x0a: // 10 or # key
- return 0x1b; // 27 or ASCII ESCAPE
-
- default:
- return oKeyPressed;
- }
-}
-
bool Wiegand::WiegandConversion (uint64_t rfidBuffer, uint16_t bitCount) {
bool bRet = false;
- // unsigned long nowTick = micros();
- // Add a maximum wait time for new bits
- // unsigned long diffTicks = nowTick - lastFoundTime;
- // unsigned long inter_code_gap = WIEGAND_CODE_GAP_FACTOR * bitTime;
- // if ((diffTicks > inter_code_gap) && (diffTicks >= 1000000 )) { // Max. 4-8 secs between 2 bits comming in. depends on micros() resolution
-
#if (DEV_WIEGAND_TEST_MODE)>0
AddLog(LOG_LEVEL_INFO, PSTR("WIE: Raw tag %llu, Bit count %u"), rfidBuffer, bitCount);
#endif // DEV_WIEGAND_TEST_MODE>0
@@ -318,7 +324,7 @@ bool Wiegand::WiegandConversion (uint64_t rfidBuffer, uint16_t bitCount) {
}
else if (4 == bitCount) {
// 4-bit Wiegand codes for keypads
- rfid = (int)translateEnterEscapeKeyPress(rfidBuffer & 0x0000000F);
+ rfid = (int)(rfidBuffer & 0x0000000F);
tagSize = bitCount;
bRet = true;
}
@@ -329,16 +335,15 @@ bool Wiegand::WiegandConversion (uint64_t rfidBuffer, uint16_t bitCount) {
char highNibble = (rfidBuffer & 0xf0) >>4;
char lowNibble = (rfidBuffer & 0x0f);
if (lowNibble == (~highNibble & 0x0f)) { // Check if low nibble matches the "NOT" of high nibble.
- rfid = (int)translateEnterEscapeKeyPress(lowNibble);
+ rfid = (int)(lowNibble);
bRet = true;
} else {
- // lastFoundTime = nowTick;
bRet = false;
}
tagSize = bitCount;
} else {
// Time reached but unknown bitCount, clear and start again
- // lastFoundTime = nowTick;
+ tagSize = 0;
bRet = false;
}
#if (DEV_WIEGAND_TEST_MODE)>0
@@ -349,8 +354,31 @@ bool Wiegand::WiegandConversion (uint64_t rfidBuffer, uint16_t bitCount) {
void Wiegand::setOutputFormat(void)
{
- if (GetOption(WIEGAND_OPTION_HEX) == 0) { outFormat = 'u'; }
- else { outFormat = 'X'; }
+ if (GetOption(WIEGAND_OPTION_HEX) == 0) { outFormat = "u"; }
+ else { outFormat = "X" WIEGAND_OPTION_HEX_POSTFIX ; }
+}
+
+void Wiegand::HandleKeyPad(void) { // will be called if a valid key pad input was recognized
+ if (GetOption(WIEGAND_OPTION_KEYPAD_TO_TAG) == 0) { // handle all key pad inputs as ONE Tag until # is recognized
+ if ( (tagSize == 4) || (tagSize == 8) ) {
+ //only handle Keypad strokes if it is requested
+ if (rfid >= 0x0a) { // # * as end of input detected -> all key values which are larger than 9
+ rfid = mqttRFIDKeypadBuffer; // original tagsize of 4 or 8 will be kept.
+ webRFIDKeypadBuffer = 0; // can be resetted, because now rfid > 0 will be used at web interface
+ mqttRFIDKeypadBuffer = 0;
+ }
+ else {
+ mqttRFIDKeypadBuffer = (mqttRFIDKeypadBuffer*10)+rfid; //left shift + new key
+ webRFIDKeypadBuffer = mqttRFIDKeypadBuffer; // visualising the current typed keys
+ rfid = 0;
+ tagSize = 0;
+ }
+ }
+ else { //it's not a key pad entry, so another key come in, we will reset the buffer, if it is not finished yet
+ webRFIDKeypadBuffer = 0;
+ mqttRFIDKeypadBuffer = 0;
+ }
+ }
}
void Wiegand::ScanForTag() {
@@ -364,7 +392,7 @@ void Wiegand::ScanForTag() {
// format MQTT output
setOutputFormat();
char sFormat[50];
- snprintf( sFormat, 50, PSTR(",\"Wiegand\":{\"UID\":%%0ll%c,\"" D_JSON_SIZE "\":%%%c}}"), outFormat, outFormat);
+ snprintf( sFormat, 50, PSTR(",\"Wiegand\":{\"UID\":%%0ll%s,\"" D_JSON_SIZE "\":%%%s}}"), outFormat, outFormat);
for (int i= 0; i < WIEGAND_RFID_ARRAY_SIZE; i++)
{
@@ -375,11 +403,14 @@ void Wiegand::ScanForTag() {
AddLog(LOG_LEVEL_INFO, PSTR("WIE: Previous tag %llu"), oldTag);
#endif // DEV_WIEGAND_TEST_MODE>0
if (validKey) { // Only in case of valid key do action. Issue#10585
- if (oldTag == rfid) {
- AddLog(LOG_LEVEL_DEBUG, PSTR("WIE: Old tag"));
+ HandleKeyPad(); //support one tag for multi key input
+ if (tagSize>0) { //do output only for rfids which are complete
+ if (oldTag == rfid) {
+ AddLog(LOG_LEVEL_DEBUG, PSTR("WIE: Old tag"));
+ }
+ ResponseTime_P(sFormat, rfid, tagSize);
+ MqttPublishTeleSensor();
}
- ResponseTime_P(sFormat, rfid,tagSize);
- MqttPublishTeleSensor();
}
rfid_found[i].RFID=0;
rfid_found[i].bitCount=0;
@@ -399,17 +430,192 @@ void Wiegand::ScanForTag() {
#ifdef USE_WEBSERVER
void Wiegand::Show(void) {
- setOutputFormat();
- char sFormat [30];
- snprintf( sFormat, 30,PSTR("{s}Wiegand UID{m}%%ll%c {e}"), outFormat);
- WSContentSend_PD(sFormat, rfid);
- //WSContentSend_PD(PSTR("{s}Wiegand UID{m}%llX {e}"), rfid);
-#if (DEV_WIEGAND_TEST_MODE)>0
- AddLog(LOG_LEVEL_INFO, PSTR("WIE: Tag %llu, Bits %u"), rfid, bitCount);
-#endif // DEV_WIEGAND_TEST_MODE>0
+ setOutputFormat();
+ char sFormat [30];
+ snprintf( sFormat, 30,PSTR("{s}Wiegand UID{m}%%ll%s {e}"), outFormat);
+ if (tagSize>0) { WSContentSend_PD(sFormat, rfid); }
+ else { WSContentSend_PD(sFormat, webRFIDKeypadBuffer); }
+
+ #if (DEV_WIEGAND_TEST_MODE)>0
+ AddLog(LOG_LEVEL_INFO, PSTR("WIE: Tag %llu, Bits %u"), rfid, bitCount);
+ #endif // DEV_WIEGAND_TEST_MODE>0
+
}
#endif // USE_WEBSERVER
+#if (DEV_WIEGAND_TEST_MODE==1)
+ void CmndTag(void);
+ void CmndTagSize(void);
+ void CmndTagGap(void);
+ void CmndTimeReset(void);
+ void CmndAllReset(void);
+ void CmndSend(void);
+ void CmndBitTime(void);
+ void CmndInterBitTime(void);
+ unsigned int setTagSize( char *);
+ unsigned int setTag ( char * );
+ void sendBit(unsigned int b);
+ void sendTag(uint32_t Tag, uint32_t TagSize);
+
+ uint32_t currTag = 0;
+ uint32_t currTagSize = 26; //default value 26 Wiegand
+ uint32_t currBitTime=(WIEGAND_BIT_TIME_DEFAULT/10); //length of the bit impluse in µs
+ uint32_t currInterBitTime = ((WIEGAND_BIT_TIME_DEFAULT/10)*9); //time to wait before next bit is send in µs
+ uint32_t currTagGabTime = (WIEGAND_BIT_TIME_DEFAULT * WIEGAND_CODE_GAP_FACTOR) ; //time to wait before next tag is send in µs
+
+
+ void CmndTag(void){
+ if (XdrvMailbox.data_len > 0) {
+ currTag= strtoul(XdrvMailbox.data, nullptr, 0);
+ }
+ ResponseCmndNumber(currTag);
+ }
+ void CmndTagSize(void){
+ if (XdrvMailbox.data_len > 0) {
+ currTagSize = setTagSize(XdrvMailbox.data);
+ }
+ ResponseCmndNumber(currTagSize);
+ }
+ void CmndTagGap(void){
+ if (XdrvMailbox.data_len > 0) {
+ currTagGabTime = strtoul(XdrvMailbox.data, nullptr, 0);
+ if (currTagGabTime < (currBitTime+currInterBitTime) ) // doesn't make sense
+ { currTagGabTime = (currBitTime+currInterBitTime) * WIEGAND_CODE_GAP_FACTOR; }
+ }
+ ResponseCmndNumber(currTagGabTime);
+ }
+ void CmndBitTime(void){
+ if (XdrvMailbox.data_len > 0) {
+ uint32_t newBitTime = strtoul(XdrvMailbox.data, nullptr, 0);
+ if ( (newBitTime >= 100) && (newBitTime <= 500000) ) // accept only values between 100µs and 5s
+ { currBitTime = newBitTime; }
+ }
+ ResponseCmndNumber(currBitTime);
+ }
+ void CmndInterBitTime(void){
+ if (XdrvMailbox.data_len > 0) {
+ uint32_t newInterBitTime = strtoul(XdrvMailbox.data, nullptr, 0);
+ if ( (newInterBitTime >= currBitTime) && (newInterBitTime <= (100 * currBitTime)) ) // accept only values between 100µs and 5s
+ { currInterBitTime = newInterBitTime; }
+ }
+ ResponseCmndNumber(currInterBitTime);
+ }
+ void CmndTimeReset(void){
+ currBitTime=(WIEGAND_BIT_TIME_DEFAULT/10);
+ currInterBitTime = ((WIEGAND_BIT_TIME_DEFAULT/10)*9);
+ currTagGabTime = (WIEGAND_BIT_TIME_DEFAULT * WIEGAND_CODE_GAP_FACTOR) ;
+ ResponseCmndChar_P(PSTR("All timings reset to default!"));
+ }
+ void CmndAllReset(void){
+ CmndTimeReset();
+ currTagSize = 26;
+ ResponseCmndChar_P(PSTR("All timings and tag size reset to default"));
+ }
+ void CmndSend(void){
+ if (XdrvMailbox.data_len > 0) { // parameter [tag[:tagsize];tag[:tagsize];...]
+ char *parameter = strtok(XdrvMailbox.data, ";");
+ while (parameter != nullptr) {
+ char* pTagSize = strchr(parameter,':'); // find optional tagsizes
+ if (pTagSize != 0) { // 2 parameters found tag:tagsize
+ *pTagSize = 0; //replace separator ':' by \0 string end
+ currTag = setTag(parameter); // is now ending before tagsize
+ pTagSize++; //set the starting char of tagsize correctly
+ currTagSize = setTagSize(pTagSize);
+ ResponseCmndChar(pTagSize);
+ }
+ else {//only one parameter (tag) found
+ currTag = setTag(parameter);
+ }
+ ResponseCmndChar(parameter);
+ sendTag(currTag, currTagSize);
+ ResponseCmndNumber(currTag);
+ parameter = strtok(nullptr, ";");
+ }
+ }
+ else { // send last used values again
+ sendTag(currTag, currTagSize);
+ ResponseCmndNumber(currTag);
+ }
+ }
+ unsigned int setTag ( char * newTag) {
+ unsigned int retValue = strtoul(newTag, nullptr, 0);
+ if ( (currTagSize == 4) || (currTagSize == 8) ) //key pad input simulation requested
+ { retValue &= 0x0F; }
+ return retValue;
+ }
+ unsigned int setTagSize ( char * newTagSize) {
+ unsigned int retValue = strtoul(newTagSize, nullptr, 0);
+ // accept only supported TagSize
+ if ( retValue <= 4) { retValue = 4;}
+ else if ( retValue <= 8) { retValue = 8;}
+ else if ( retValue <= 24) { retValue = 24;}
+ else if ( retValue <= 26) { retValue = 26;}
+ else if ( retValue <= 32) { retValue = 32;}
+ else if ( retValue <= 34) { retValue = 34;}
+ else { retValue = 26;} //default value
+ return retValue;
+ }
+ void sendBit(unsigned int b) {
+ int sel = (b == 0) ? Pin(GPIO_WIEGAND_D0) : Pin(GPIO_WIEGAND_D1);
+ digitalWrite(sel, 0);
+ delayMicroseconds(currBitTime); // bit impuls time
+ digitalWrite(sel, 1);
+ delayMicroseconds(currBitTime+currInterBitTime); // bit + inter bit gap time
+ }
+ void sendPlainTag( uint32_t pTag, uint32_t pTagSize){ // send tag without parity
+ for (int i=1; i<=pTagSize; ++i)
+ {
+ sendBit((pTag >> (pTagSize-i)) & 1);
+ }
+ }
+ void sendTag(uint32_t Tag, uint32_t TagSize) {
+ // TagSize is the requested output tagSize. means b.e. 24 bit == 24 Tag without parity 26 bit = 24 bit with parity bits
+ // supported tag sizes 4/8 for key pad simulation 24/26 and 32/34 for RFID tags
+ switch (TagSize){
+ case 24:
+ case 32:
+ case 4:
+ sendPlainTag( Tag, TagSize);
+ break;
+ case 26:
+ case 34:
+ uint8_t parity;
+ parity = oWiegand->CalculateParities(Tag, TagSize);
+ sendBit(parity & 0x01); //even parity (starting parity)
+ sendPlainTag( Tag, TagSize-2);
+ sendBit(parity & 0x80); //odd parity (ending parity)
+ break;
+ case 8: // high nibble is ~ low nibble
+ Tag = Tag & 0x0F; // low nibble in case of more the one char input it will be cut here
+ Tag = Tag | ((~Tag) << 4);
+ sendPlainTag ( Tag, TagSize);
+ break;
+ }
+ //delay to simulate end of tag
+ delayMicroseconds(currTagGabTime); // inter code gap
+ return;
+}
+const char kWiegandCommands[] PROGMEM = "Wie|" // No prefix
+ "Tag|"
+ "TagSize|"
+ "TagGap|"
+ "BitTime|"
+ "InterBitTime|"
+ "TimeReset|"
+ "AllReset|"
+ "Send";
+
+ void (* const WiegandCommand[])(void) PROGMEM = {
+ &CmndTag,
+ &CmndTagSize,
+ &CmndTagGap,
+ &CmndBitTime,
+ &CmndInterBitTime,
+ &CmndTimeReset,
+ &CmndAllReset,
+ &CmndSend
+ };
+#endif //(DEV_WIEGAND_TEST_MODE==1)
/*********************************************************************************************\
* Interface
\*********************************************************************************************/
@@ -430,6 +636,11 @@ bool Xsns82(byte function) {
oWiegand->Show();
break;
#endif // USE_WEBSERVER
+#if (DEV_WIEGAND_TEST_MODE==1)
+ case FUNC_COMMAND:
+ result = DecodeCommand(kWiegandCommands, WiegandCommand);
+ break;
+#endif //(DEV_WIEGAND_TEST_MODE==1)
}
}
return result;