From 33e1da84e7c7fa63b3569e865d04cffbcdfb1e39 Mon Sep 17 00:00:00 2001 From: md5sum-as Date: Fri, 25 Oct 2024 17:45:26 +0300 Subject: [PATCH] Xsns 102 ld2410 (#21880) * xsns_102_ld2410.ino add commands * fix * Add attension about supported devices * Fix lang files --- tasmota/include/tasmota_types.h | 2 +- tasmota/language/af_AF.h | 12 +- tasmota/language/bg_BG.h | 12 +- tasmota/language/ca_AD.h | 12 +- tasmota/language/cs_CZ.h | 12 +- tasmota/language/de_DE.h | 12 +- tasmota/language/el_GR.h | 12 +- tasmota/language/en_GB.h | 12 +- tasmota/language/es_ES.h | 12 +- tasmota/language/fr_FR.h | 12 +- tasmota/language/fy_NL.h | 12 +- tasmota/language/he_HE.h | 12 +- tasmota/language/hu_HU.h | 12 +- tasmota/language/it_IT.h | 12 +- tasmota/language/ko_KO.h | 12 +- tasmota/language/nl_NL.h | 12 +- tasmota/language/pl_PL.h | 12 +- tasmota/language/pt_BR.h | 12 +- tasmota/language/pt_PT.h | 12 +- tasmota/language/ro_RO.h | 12 +- tasmota/language/ru_RU.h | 12 +- tasmota/language/sk_SK.h | 12 +- tasmota/language/sv_SE.h | 12 +- tasmota/language/tr_TR.h | 12 +- tasmota/language/uk_UA.h | 12 +- tasmota/language/vi_VN.h | 12 +- tasmota/language/zh_CN.h | 12 +- tasmota/language/zh_TW.h | 12 +- tasmota/my_user_config.h | 2 +- .../tasmota_xsns_sensor/xsns_102_ld2410.ino | 140 +++++++++++++++--- 30 files changed, 364 insertions(+), 104 deletions(-) mode change 100755 => 100644 tasmota/include/tasmota_types.h diff --git a/tasmota/include/tasmota_types.h b/tasmota/include/tasmota_types.h old mode 100755 new mode 100644 index 241f8c249..3ad75c19a --- a/tasmota/include/tasmota_types.h +++ b/tasmota/include/tasmota_types.h @@ -194,7 +194,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t neopool_outputsensitive : 1; // bit 11 (v13.2.0.1) - SetOption157 - (NeoPool) Output sensitive data (1) uint32_t mqtt_disable_modbus : 1; // bit 12 (v13.3.0.5) - SetOption158 - (MQTT) Disable publish ModbusReceived MQTT messages (1), you must use event trigger rules instead uint32_t counter_both_edges : 1; // bit 13 (v13.3.0.5) - SetOption159 - (Counter) Enable counting on both rising and falling edge (1) - uint32_t spare14 : 1; // bit 14 + uint32_t ld2410_use_pin : 1; // bit 14 (development) - SetOption160 - (LD2410) Disable generate moving event by sensor report - use LD2410 out pin for events (1) uint32_t spare15 : 1; // bit 15 uint32_t spare16 : 1; // bit 16 uint32_t spare17 : 1; // bit 17 diff --git a/tasmota/language/af_AF.h b/tasmota/language/af_AF.h index 0c55d7f18..833b69109 100644 --- a/tasmota/language/af_AF.h +++ b/tasmota/language/af_AF.h @@ -87,9 +87,6 @@ #define D_DEBUG "Ontfout" #define D_DEWPOINT "Dou punt" #define D_DISABLED "Gedeaktiveer" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Afstand" #define D_DNS_SERVER "DNS" #define D_DO "Opgeloste suurstof" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/bg_BG.h b/tasmota/language/bg_BG.h index 78ba90ca2..c9d21ebbf 100644 --- a/tasmota/language/bg_BG.h +++ b/tasmota/language/bg_BG.h @@ -87,9 +87,6 @@ #define D_DEBUG "Премахване на дефекти" #define D_DEWPOINT "Температура на оросяване" #define D_DISABLED "Забранено" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Разстояние" #define D_DNS_SERVER "Сървър на DNS" #define D_DO "Разтворен кислород" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/ca_AD.h b/tasmota/language/ca_AD.h index 894362945..b1b4e3774 100644 --- a/tasmota/language/ca_AD.h +++ b/tasmota/language/ca_AD.h @@ -87,9 +87,6 @@ #define D_DEBUG "Depuració" #define D_DEWPOINT "Punt de rossada" #define D_DISABLED "Deshabilitat" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Distancia" #define D_DNS_SERVER "Servidor DNS" #define D_DO "Oxígen dissolt" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/cs_CZ.h b/tasmota/language/cs_CZ.h index 4df9b761b..34f4960a5 100644 --- a/tasmota/language/cs_CZ.h +++ b/tasmota/language/cs_CZ.h @@ -87,9 +87,6 @@ #define D_DEBUG "Debug" #define D_DEWPOINT "Dew point" #define D_DISABLED "Zablokováno" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Distance" #define D_DNS_SERVER "Server DNS" #define D_DO "Disolved Oxygen" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/de_DE.h b/tasmota/language/de_DE.h index 77f0f5bd3..4dd0ef06b 100644 --- a/tasmota/language/de_DE.h +++ b/tasmota/language/de_DE.h @@ -87,9 +87,6 @@ #define D_DEBUG "debug" #define D_DEWPOINT "Taupunkt" #define D_DISABLED "deaktiviert" -#define D_MOVING_DISTANCE "Abstand bewegt" -#define D_STATIC_DISTANCE "Abstand fix" -#define D_DETECT_DISTANCE "Abstandsfeststellung" #define D_DISTANCE "Abstand" #define D_DNS_SERVER "DNS-Server" #define D_DO "gelöster Sauerstoff" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Abstand bewegt" +#define D_STATIC_DISTANCE "Abstand fix" +#define D_DETECT_DISTANCE "Abstandsfeststellung" +#define D_MOVING_ENERGY_T "Bewegliches Ziel" +#define D_STATIC_ENERGY_T "Statisches Ziel" +#define D_LD2410_PIN_STATE "Zustand des Ausgangspins" +#define D_LD2410_LIGHT "Lichtsensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/el_GR.h b/tasmota/language/el_GR.h index 4915b82ff..8bee01c59 100644 --- a/tasmota/language/el_GR.h +++ b/tasmota/language/el_GR.h @@ -87,9 +87,6 @@ #define D_DEBUG "Debug" #define D_DEWPOINT "Dew point" #define D_DISABLED "Ανενεργό" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Απόσταση" #define D_DNS_SERVER "Διακομιστής DNS" #define D_DO "Disolved Oxygen" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/en_GB.h b/tasmota/language/en_GB.h index edd3370dd..89b97304f 100644 --- a/tasmota/language/en_GB.h +++ b/tasmota/language/en_GB.h @@ -87,9 +87,6 @@ #define D_DEBUG "Debug" #define D_DEWPOINT "Dew point" #define D_DISABLED "Disabled" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Distance" #define D_DNS_SERVER "DNS Server" #define D_DO "Disolved Oxygen" @@ -1282,6 +1279,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/es_ES.h b/tasmota/language/es_ES.h index 77eb3c295..12573a7ea 100644 --- a/tasmota/language/es_ES.h +++ b/tasmota/language/es_ES.h @@ -87,9 +87,6 @@ #define D_DEBUG "Debug" #define D_DEWPOINT "Punto de Rocío" #define D_DISABLED "Deshabilitado" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Distancia" #define D_DNS_SERVER "Servidor DNS" #define D_DO "Oxígeno Disuelto" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/fr_FR.h b/tasmota/language/fr_FR.h index 41dd53979..ff797e535 100644 --- a/tasmota/language/fr_FR.h +++ b/tasmota/language/fr_FR.h @@ -87,9 +87,6 @@ #define D_DEBUG "Debug" #define D_DEWPOINT "Point de rosée" #define D_DISABLED "Désactivé" -#define D_MOVING_DISTANCE "Distance mobile" -#define D_STATIC_DISTANCE "Distance fixe" -#define D_DETECT_DISTANCE "Distance détectée" #define D_DISTANCE "Distance" #define D_DNS_SERVER "Serveur DNS" #define D_DO "Oxygène dissout" @@ -1282,6 +1279,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Distance mobile" +#define D_STATIC_DISTANCE "Distance fixe" +#define D_DETECT_DISTANCE "Distance détectée" +#define D_MOVING_ENERGY_T "Cible mouvante" +#define D_STATIC_ENERGY_T "Cible statique" +#define D_LD2410_PIN_STATE "État de la broche de sortie" +#define D_LD2410_LIGHT "Capteur de lumière" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/fy_NL.h b/tasmota/language/fy_NL.h index 2fe8b6eec..f453906c1 100644 --- a/tasmota/language/fy_NL.h +++ b/tasmota/language/fy_NL.h @@ -87,9 +87,6 @@ #define D_DEBUG "Debugearje" #define D_DEWPOINT "Dauwpunt" #define D_DISABLED "Útsetten" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Ôfstân" #define D_DNS_SERVER "DNS Server" #define D_DO "Oploste soerstof" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/he_HE.h b/tasmota/language/he_HE.h index 97615d7b7..0470168d6 100644 --- a/tasmota/language/he_HE.h +++ b/tasmota/language/he_HE.h @@ -87,9 +87,6 @@ #define D_DEBUG "באגים" #define D_DEWPOINT "Dew point" #define D_DISABLED "מבוטל" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "מרחק" #define D_DNS_SERVER "DNS שרת" #define D_DO "Disolved Oxygen" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/hu_HU.h b/tasmota/language/hu_HU.h index e9370b023..7d3360d5e 100644 --- a/tasmota/language/hu_HU.h +++ b/tasmota/language/hu_HU.h @@ -87,9 +87,6 @@ #define D_DEBUG "Debug" #define D_DEWPOINT "Harmatpont" #define D_DISABLED "Letiltva" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Távolság" #define D_DNS_SERVER "DNS szerver" #define D_DO "Oldott oxygén" @@ -1284,6 +1281,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/it_IT.h b/tasmota/language/it_IT.h index 56ceb08af..b4db89599 100644 --- a/tasmota/language/it_IT.h +++ b/tasmota/language/it_IT.h @@ -87,9 +87,6 @@ #define D_DEBUG "Debug" #define D_DEWPOINT "Punto rugiada" // #define D_DISABLED "Disabilitato/a" -#define D_MOVING_DISTANCE "Distanza in movimento" -#define D_STATIC_DISTANCE "Distanza statica" -#define D_DETECT_DISTANCE "Rileva distanza" #define D_DISTANCE "Distanza" #define D_DNS_SERVER "Server DNS" #define D_DO "Ossigeno dissolto" @@ -1282,6 +1279,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar - TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar - RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Distanza in movimento" +#define D_STATIC_DISTANCE "Distanza statica" +#define D_DETECT_DISTANCE "Rileva distanza" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Target statico" +#define D_LD2410_PIN_STATE "Stato pin di uscita" +#define D_LD2410_LIGHT "Sensore di luce" + // xsns_115_wooliis.ino #define D_IMPORT "Importa" #define D_EXPORT "Esporta" diff --git a/tasmota/language/ko_KO.h b/tasmota/language/ko_KO.h index a4208da31..04fea6e29 100644 --- a/tasmota/language/ko_KO.h +++ b/tasmota/language/ko_KO.h @@ -87,9 +87,6 @@ #define D_DEBUG "디버그" #define D_DEWPOINT "Dew point" #define D_DISABLED "사용안함" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "거리" #define D_DNS_SERVER "DNS 서버" #define D_DO "Disolved Oxygen" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/nl_NL.h b/tasmota/language/nl_NL.h index 6e0a38287..e7485142d 100644 --- a/tasmota/language/nl_NL.h +++ b/tasmota/language/nl_NL.h @@ -87,9 +87,6 @@ #define D_DEBUG "Debug" #define D_DEWPOINT "Dauwpunt" #define D_DISABLED "Uitgeschakeld" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Afstand" #define D_DNS_SERVER "DNS Server" #define D_DO "Opgelost zuurstof" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/pl_PL.h b/tasmota/language/pl_PL.h index 56d95235d..ad6a7f7a3 100644 --- a/tasmota/language/pl_PL.h +++ b/tasmota/language/pl_PL.h @@ -87,9 +87,6 @@ #define D_DEBUG "Debug" #define D_DEWPOINT "Punkt rosy" #define D_DISABLED "Wyłączony" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Odległość" #define D_DNS_SERVER "Serwer DNS" #define D_DO "Rozpuszczalność tlenu" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/pt_BR.h b/tasmota/language/pt_BR.h index 5d21edca2..aa24ef463 100644 --- a/tasmota/language/pt_BR.h +++ b/tasmota/language/pt_BR.h @@ -87,9 +87,6 @@ #define D_DEBUG "Depurar" #define D_DEWPOINT "Ponto de orvalho" #define D_DISABLED "Desabilitado" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Distância" #define D_DNS_SERVER "Servidor DNS" #define D_DO "Oxigênio dissolvido" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/pt_PT.h b/tasmota/language/pt_PT.h index 3108fd24c..36a229459 100644 --- a/tasmota/language/pt_PT.h +++ b/tasmota/language/pt_PT.h @@ -87,9 +87,6 @@ #define D_DEBUG "Depurar" #define D_DEWPOINT "Ponto de Condensação" #define D_DISABLED "Disabilitado" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Distância" #define D_DNS_SERVER "Servidor DNS" #define D_DO "Oxigénio Dissolvido" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/ro_RO.h b/tasmota/language/ro_RO.h index eb5042cad..77c696942 100644 --- a/tasmota/language/ro_RO.h +++ b/tasmota/language/ro_RO.h @@ -87,9 +87,6 @@ #define D_DEBUG "Depanare" #define D_DEWPOINT "Punct de rouă" #define D_DISABLED "Dezactivat" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Distanță" #define D_DNS_SERVER "Server DNS" #define D_DO "Disolved Oxygen" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/ru_RU.h b/tasmota/language/ru_RU.h index a6180994a..3092ba52a 100644 --- a/tasmota/language/ru_RU.h +++ b/tasmota/language/ru_RU.h @@ -88,9 +88,6 @@ #define D_DEBUG "Отладка" #define D_DEWPOINT "Dew point" #define D_DISABLED "Блокирован" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Расстояние" #define D_DNS_SERVER "DNS Сервер" #define D_DO "Disolved Oxygen" @@ -1282,6 +1279,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/sk_SK.h b/tasmota/language/sk_SK.h index 2affb9750..3eadc6ece 100644 --- a/tasmota/language/sk_SK.h +++ b/tasmota/language/sk_SK.h @@ -89,9 +89,6 @@ #define D_DEBUG "Debug" #define D_DEWPOINT "Dew point" #define D_DISABLED "Zablokované" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Vzdialenosť" #define D_DNS_SERVER "Server DNS" #define D_DO "Disolved Oxygen" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/sv_SE.h b/tasmota/language/sv_SE.h index 486d4939a..a75f9051e 100644 --- a/tasmota/language/sv_SE.h +++ b/tasmota/language/sv_SE.h @@ -87,9 +87,6 @@ #define D_DEBUG "Debug" #define D_DEWPOINT "Dew point" #define D_DISABLED "Inaktiverad" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Distans" #define D_DNS_SERVER "DNS-server" #define D_DO "Disolved Oxygen" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/tr_TR.h b/tasmota/language/tr_TR.h index 2da473200..aefb8dd9d 100644 --- a/tasmota/language/tr_TR.h +++ b/tasmota/language/tr_TR.h @@ -87,9 +87,6 @@ #define D_DEBUG "Hata Ayıklama" #define D_DEWPOINT "Dew point" #define D_DISABLED "Etkin Değil" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Mesage" #define D_DNS_SERVER "DNS Sunucu" #define D_DO "Disolved Oxygen" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/uk_UA.h b/tasmota/language/uk_UA.h index bb2210680..e3fe0db29 100644 --- a/tasmota/language/uk_UA.h +++ b/tasmota/language/uk_UA.h @@ -87,9 +87,6 @@ #define D_DEBUG "Налагодження" #define D_DEWPOINT "Tочка роси" #define D_DISABLED "Вимкнено" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Відстань" #define D_DNS_SERVER "Сервер DNS" #define D_DO "Disolved Oxygen" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/vi_VN.h b/tasmota/language/vi_VN.h index ef176f815..335c7a370 100644 --- a/tasmota/language/vi_VN.h +++ b/tasmota/language/vi_VN.h @@ -87,9 +87,6 @@ #define D_DEBUG "Tìm lỗi" #define D_DEWPOINT "Điểm sương" #define D_DISABLED "Vô hiệu hóa" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "Khoảng cách" #define D_DNS_SERVER "Máy chủ DNS" #define D_DO "Disolved Oxygen" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/zh_CN.h b/tasmota/language/zh_CN.h index a11e94e57..05474720f 100644 --- a/tasmota/language/zh_CN.h +++ b/tasmota/language/zh_CN.h @@ -87,9 +87,6 @@ #define D_DEBUG "调试" #define D_DEWPOINT "Dew point" #define D_DISABLED "禁用" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "距离" #define D_DNS_SERVER "DNS服务器" #define D_DO "Disolved Oxygen" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/language/zh_TW.h b/tasmota/language/zh_TW.h index b2c08d951..8cb743922 100644 --- a/tasmota/language/zh_TW.h +++ b/tasmota/language/zh_TW.h @@ -87,9 +87,6 @@ #define D_DEBUG "偵錯" #define D_DEWPOINT "Dew point" #define D_DISABLED "已停用" -#define D_MOVING_DISTANCE "Moving Distance" -#define D_STATIC_DISTANCE "Static Distance" -#define D_DETECT_DISTANCE "Detect Distance" #define D_DISTANCE "距離" #define D_DNS_SERVER "DNS伺服器" #define D_DO "Disolved Oxygen" @@ -1281,6 +1278,15 @@ #define D_SENSOR_PIPSOLAR_TX "Pipsolar TX" #define D_SENSOR_PIPSOLAR_RX "Pipsolar RX" +// xsns_102_ld2410.ino +#define D_MOVING_DISTANCE "Moving Distance" +#define D_STATIC_DISTANCE "Static Distance" +#define D_DETECT_DISTANCE "Detect Distance" +#define D_MOVING_ENERGY_T "Moving target" +#define D_STATIC_ENERGY_T "Static target" +#define D_LD2410_PIN_STATE "Output pin state" +#define D_LD2410_LIGHT "Light sensor" + // xsns_115_wooliis.ino #define D_IMPORT "Import" #define D_EXPORT "Export" diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index e9d8128bb..c7955d636 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -880,7 +880,7 @@ //#define USE_VINDRIKTNING // Add support for IKEA VINDRIKTNING particle concentration sensor (+0k6 code) // #define VINDRIKTNING_SHOW_PM1 // Display undocumented/supposed PM1.0 values // #define VINDRIKTNING_SHOW_PM10 // Display undocumented/supposed PM10 values -//#define USE_LD2410 // Add support for HLK-LD2410 24GHz smart wave motion sensor (+2k8 code) +//#define USE_LD2410 // Add support for HLK-LD2410 24GHz smart wave motion sensor (+3k7 code) //#define USE_LOX_O2 // Add support for LuminOx LOX O2 Sensor (+0k8 code) //#define USE_GM861 // Add support for GM861 1D and 2D Bar Code Reader (+1k3 code) // #define GM861_DECODE_AIM // Decode AIM-id (+0k3 code) diff --git a/tasmota/tasmota_xsns_sensor/xsns_102_ld2410.ino b/tasmota/tasmota_xsns_sensor/xsns_102_ld2410.ino index 8d80d3199..50dcb846e 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_102_ld2410.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_102_ld2410.ino @@ -1,7 +1,7 @@ /* xsns_102_ld2410.ino - HLK-LD2410 24GHz smart wave motion sensor support for Tasmota - SPDX-FileCopyrightText: 2022 Theo Arends + SPDX-FileCopyrightText: 2022 Theo Arends, 2024 md5sum-as (https://github.com/md5sum-as) SPDX-License-Identifier: GPL-3.0-only */ @@ -9,12 +9,21 @@ #ifdef USE_LD2410 /*********************************************************************************************\ * HLK-LD2410 24GHz smart wave motion sensor - * + * + * Attention! + * This module works with HLK-LD2410, HLK-LD2410B (md5sum-as tested), HLK-LD2410C (md5sum-as tested) devices. + * The module does not support HLK-LD2410S (md5sum-as tested) and is not guaranteed to work with other devices. + * + * * LD2410Duration 0 - Set factory default settings * LD2410Duration 1..65535 - Set no-one duration in seconds (default 5) * LD2410MovingSens 50,50,40,30,20,15,15,15,15 - Set moving distance sensitivity for up to 9 gates (at 0.75 meter interval) * LD2410StaticSens 0,0,40,40,30,30,20,20,20 - Set static distance sensitivity for up to 9 gates (at 0.75 meter interval) * + * LD2410Get - Read last sensors + * LD2410EngineeringStart - Start engineering mode + * LD2410EngineeringEnd - End engineering mode + * * Inspiration: * https://community.home-assistant.io/t/mmwave-wars-one-sensor-module-to-rule-them-all/453260/2 * Resources: @@ -69,6 +78,14 @@ struct { uint8_t settings; uint8_t byte_counter; bool valid_response; + uint8_t set_engin_mode; + uint8_t web_engin_mode; + struct { + uint8_t moving_gate_energy[LD2410_MAX_GATES +1]; + uint8_t static_gate_energy[LD2410_MAX_GATES +1]; + uint8_t light; + uint8_t out_pin; + } engineering; } LD2410; /********************************************************************************************/ @@ -80,7 +97,10 @@ uint32_t ToBcd(uint32_t value) { /********************************************************************************************/ void Ld1410HandleTargetData(void) { - if ((0x0D == LD2410.buffer[4]) && (0x55 == LD2410.buffer[17])) { // Add bad reception detection + uint8_t i; + + if (((0x0D == LD2410.buffer[4]) && (0x55 == LD2410.buffer[17]) && (0x02 == LD2410.buffer[6])) + or ((0x23 == LD2410.buffer[4]) && (0x55 == LD2410.buffer[39]) && (0x01 == LD2410.buffer[6]))) { // Add bad reception detection // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 // F4 F3 F2 F1 0D 00 02 AA 00 00 00 00 00 00 37 00 00 55 00 F8 F7 F6 F5 - No target // F4 F3 F2 F1 0D 00 02 AA 00 45 00 3E 00 00 3A 00 00 55 00 F8 F7 F6 F5 - No target @@ -88,30 +108,55 @@ void Ld1410HandleTargetData(void) { // F4 F3 F2 F1 0D 00 02 AA 02 54 00 00 00 00 64 00 00 55 00 F8 F7 F6 F5 - Stationary target // F4 F3 F2 F1 0D 00 02 AA 02 96 00 00 00 00 36 00 00 55 00 F8 F7 F6 F5 - Stationary target // F4 F3 F2 F1 0D 00 02 AA 03 2A 00 64 00 00 64 00 00 55 00 F8 F7 F6 F5 - Movement and Stationary target + // + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 + // F4 F3 F2 F1 23 00 01 AA 00 1E 00 00 1E 00 0D 00 00 08 08 13 0E 07 02 05 07 03 04 05 00 00 0D 06 05 05 05 05 05 62 00 55 00 F8 F7 F6 F5 + // + // F4 F3 F2 F1 23 00 01 AA 02 20 01 00 37 01 64 26 01 + // 08 08 - max moving and static dist (17,18) + // 12 05 04 09 0C 0D 0F 04 01 - Movement energy (19-27) + // 00 00 1F 64 64 64 64 31 1A - Static energy (28-36) + // 8C - Photo sens (37) + // 01 - Out pin (38) + // 55 00 F8 F7 F6 F5 // header |len |dt|hd|st|movin|me|stati|se|detec|tr|ck|trailer + + LD2410.moving_distance = 0; + LD2410.moving_energy = 0; + LD2410.static_distance = 0; + LD2410.static_energy = 0; + LD2410.detect_distance = 0; + if (LD2410.buffer[8] != 0x00) { // Movement and/or Stationary target LD2410.moving_distance = LD2410.buffer[10] << 8 | LD2410.buffer[9]; LD2410.moving_energy = LD2410.buffer[11]; LD2410.static_distance = LD2410.buffer[13] << 8 | LD2410.buffer[12]; LD2410.static_energy = LD2410.buffer[14]; LD2410.detect_distance = LD2410.buffer[16] << 8 | LD2410.buffer[15]; - /* - AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("LD2: Type %d, State %d, Moving %d/%d%%, Static %d/%d%%, Detect %d"), - LD2410.buffer[6], LD2410.buffer[8], - LD2410.moving_distance, LD2410.moving_energy, - LD2410.static_distance, LD2410.static_energy, - LD2410.detect_distance); - */ - if (0x01 == LD2410.buffer[6]) { // Engineering mode data - // Adds 22 extra bytes of data + } + LD2410.web_engin_mode = LD2410.buffer[6]==1?1:0; + if (0x01 == LD2410.buffer[6]) { /* Engineering mode*/ + if (LD2410.buffer[17] < 9) { + for (i=0; i<= LD2410.buffer[17]; i++) { + LD2410.engineering.moving_gate_energy[i] = LD2410.buffer[i+19]; + } } - } else { - LD2410.moving_distance = 0; - LD2410.moving_energy = 0; - LD2410.static_distance = 0; - LD2410.static_energy = 0; - LD2410.detect_distance = 0; + if (LD2410.buffer[18] < 9) { + for (i=0; i<= LD2410.buffer[18]; i++) { + LD2410.engineering.static_gate_energy[i] = LD2410.buffer[i+28]; + } + } + LD2410.engineering.light=LD2410.buffer[37]; + LD2410.engineering.out_pin=LD2410.buffer[38]; + // AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("LD2 Eng: mov: %d %d %d %d %d %d %d %d %d, st: %d %d %d %d %d %d %d %d %d, light: %d, out: %d"), + // LD2410.engineering.moving_gate_energy[0],LD2410.engineering.moving_gate_energy[1],LD2410.engineering.moving_gate_energy[2], + // LD2410.engineering.moving_gate_energy[3],LD2410.engineering.moving_gate_energy[4],LD2410.engineering.moving_gate_energy[5], + // LD2410.engineering.moving_gate_energy[6],LD2410.engineering.moving_gate_energy[7],LD2410.engineering.moving_gate_energy[8], + // LD2410.engineering.static_gate_energy[0],LD2410.engineering.static_gate_energy[1],LD2410.engineering.static_gate_energy[2], + // LD2410.engineering.static_gate_energy[3],LD2410.engineering.static_gate_energy[4],LD2410.engineering.static_gate_energy[5], + // LD2410.engineering.static_gate_energy[6],LD2410.engineering.static_gate_energy[7],LD2410.engineering.static_gate_energy[8], + // LD2410.engineering.light,LD2410.engineering.out_pin); } } } @@ -355,6 +400,18 @@ void Ld2410Every100MSecond(void) { LD2410Serial->begin(57600); break; */ + case 17: + Ld2410SetConfigMode(); // Stop running mode + break; + case 14: + if (0 == LD2410.set_engin_mode) { + Ld2410SendCommand(LD2410_CMND_END_ENGINEERING); + } else { + Ld2410SendCommand(LD2410_CMND_START_ENGINEERING); + } + LD2410.step = 2; + break; + // case 12: Init case 5: Ld2410SetConfigMode(); // Stop running mode @@ -393,7 +450,8 @@ void Ld2410Every100MSecond(void) { } void Ld2410EverySecond(void) { - if (LD2410.moving_energy) { + if (LD2410.moving_energy and (!Settings->flag6.ld2410_use_pin)) { + // Send state change to be captured by rules // {"Time":"2022-11-26T10:48:16","Switch1":"ON","LD2410":{"Distance":[125.0,0.0,0.0],"Energy":[0,100]}} MqttPublishSensor(); @@ -414,6 +472,8 @@ void Ld2410Detect(void) { LD2410.retry = 4; LD2410.step = 12; } + LD2410.set_engin_mode = 0; + memset(&LD2410.engineering,0,sizeof(LD2410.engineering)); } } @@ -422,10 +482,10 @@ void Ld2410Detect(void) { \*********************************************************************************************/ const char kLd2410Commands[] PROGMEM = "LD2410|" // Prefix - "Duration|MovingSens|StaticSens"; + "Duration|MovingSens|StaticSens|Get|EngineeringEnd|EngineeringStart"; void (* const Ld2410Command[])(void) PROGMEM = { - &CmndLd2410Duration, &CmndLd2410MovingSensitivity, &CmndLd2410StaticSensitivity }; + &CmndLd2410Duration, &CmndLd2410MovingSensitivity, &CmndLd2410StaticSensitivity, &CmndLd2410last, &CmndLd2410EngineeringEnd, &CmndLd2410EngineeringStart }; void Ld2410Response(void) { Response_P(PSTR("{\"LD2410\":{\"Duration\":%d,\"Moving\":{\"Gates\":%d,\"Sensitivity\":["), @@ -483,6 +543,29 @@ void CmndLd2410StaticSensitivity(void) { Ld2410Response(); } +void CmndLd2410last(void) { + Response_P(PSTR("{\"LD2410\":{\"Moving energy\":[%d,%d,%d,%d,%d,%d,%d,%d,%d],\"Static energy\":[%d,%d,%d,%d,%d,%d,%d,%d,%d],\"Light\":%d,\"Out_pin\":%d}}"), + LD2410.engineering.moving_gate_energy[0],LD2410.engineering.moving_gate_energy[1],LD2410.engineering.moving_gate_energy[2], + LD2410.engineering.moving_gate_energy[3],LD2410.engineering.moving_gate_energy[4],LD2410.engineering.moving_gate_energy[5], + LD2410.engineering.moving_gate_energy[6],LD2410.engineering.moving_gate_energy[7],LD2410.engineering.moving_gate_energy[8], + LD2410.engineering.static_gate_energy[0],LD2410.engineering.static_gate_energy[1],LD2410.engineering.static_gate_energy[2], + LD2410.engineering.static_gate_energy[3],LD2410.engineering.static_gate_energy[4],LD2410.engineering.static_gate_energy[5], + LD2410.engineering.static_gate_energy[6],LD2410.engineering.static_gate_energy[7],LD2410.engineering.static_gate_energy[8], + LD2410.engineering.light,LD2410.engineering.out_pin); +} + +void CmndLd2410EngineeringEnd(void) { + LD2410.set_engin_mode = 0; + LD2410.step = 18; + Response_P(PSTR("LD2410: End engineering mode")); +} + +void CmndLd2410EngineeringStart(void) { + LD2410.set_engin_mode= 1; + LD2410.step = 18; + Response_P(PSTR("LD2410: Start engineering mode")); +} + /*********************************************************************************************\ * Presentation \*********************************************************************************************/ @@ -492,6 +575,11 @@ const char HTTP_SNS_LD2410_CM[] PROGMEM = "{s}LD2410 " D_MOVING_DISTANCE "{m}%1_f " D_UNIT_CENTIMETER "{e}" "{s}LD2410 " D_STATIC_DISTANCE "{m}%1_f " D_UNIT_CENTIMETER "{e}" "{s}LD2410 " D_DETECT_DISTANCE "{m}%1_f " D_UNIT_CENTIMETER "{e}"; +const char HTTP_SNS_LD2410_ENG[] PROGMEM = + "{s}LD2410 " D_MOVING_ENERGY_T "{m}%d %d %d %d %d %d %d %d %d{e}" + "{s}LD2410 " D_STATIC_ENERGY_T "{m}%d %d %d %d %d %d %d %d %d{e}" + "{s}LD2410 " D_LD2410_LIGHT "{m}%d{e}" + "{s}LD2410 " D_LD2410_PIN_STATE "{m}%d{e}"; #endif void Ld2410Show(bool json) { @@ -505,6 +593,16 @@ void Ld2410Show(bool json) { #ifdef USE_WEBSERVER } else { WSContentSend_PD(HTTP_SNS_LD2410_CM, &moving_distance, &static_distance, &detect_distance); + if (LD2410.web_engin_mode == 1) { + WSContentSend_PD(HTTP_SNS_LD2410_ENG, + LD2410.engineering.moving_gate_energy[0],LD2410.engineering.moving_gate_energy[1],LD2410.engineering.moving_gate_energy[2], + LD2410.engineering.moving_gate_energy[3],LD2410.engineering.moving_gate_energy[4],LD2410.engineering.moving_gate_energy[5], + LD2410.engineering.moving_gate_energy[6],LD2410.engineering.moving_gate_energy[7],LD2410.engineering.moving_gate_energy[8], + LD2410.engineering.static_gate_energy[0],LD2410.engineering.static_gate_energy[1],LD2410.engineering.static_gate_energy[2], + LD2410.engineering.static_gate_energy[3],LD2410.engineering.static_gate_energy[4],LD2410.engineering.static_gate_energy[5], + LD2410.engineering.static_gate_energy[6],LD2410.engineering.static_gate_energy[7],LD2410.engineering.static_gate_energy[8], + LD2410.engineering.light,LD2410.engineering.out_pin); + } #endif } }