From 5998fe856a588712a46b99b9be0dd39e2c25f7cd Mon Sep 17 00:00:00 2001 From: Helge Date: Tue, 4 Oct 2022 15:48:27 +0200 Subject: [PATCH] added code recommendations and reduce functionality to the most necessary --- tasmota/include/i18n.h | 8 +- tasmota/language/af_AF.h | 9 +- tasmota/language/bg_BG.h | 9 +- tasmota/language/ca_AD.h | 9 +- tasmota/language/cs_CZ.h | 9 +- tasmota/language/de_DE.h | 9 +- tasmota/language/el_GR.h | 9 +- tasmota/language/en_GB.h | 9 +- tasmota/language/es_ES.h | 9 +- tasmota/language/fr_FR.h | 9 +- tasmota/language/fy_NL.h | 9 +- tasmota/language/he_HE.h | 9 +- tasmota/language/hu_HU.h | 9 +- tasmota/language/it_IT.h | 9 +- tasmota/language/ko_KO.h | 9 +- tasmota/language/nl_NL.h | 9 +- tasmota/language/pl_PL.h | 9 +- tasmota/language/pt_BR.h | 9 +- tasmota/language/pt_PT.h | 9 +- tasmota/language/ro_RO.h | 9 +- tasmota/language/ru_RU.h | 9 +- tasmota/language/sk_SK.h | 9 +- tasmota/language/sv_SE.h | 9 +- tasmota/language/tr_TR.h | 9 +- tasmota/language/uk_UA.h | 9 +- tasmota/language/vi_VN.h | 9 +- tasmota/language/zh_CN.h | 9 +- tasmota/language/zh_TW.h | 9 +- tasmota/my_user_config.h | 4 +- .../tasmota_xsns_sensor/xsns_33_qmc5883l.ino | 150 +++++------------- 30 files changed, 157 insertions(+), 248 deletions(-) diff --git a/tasmota/include/i18n.h b/tasmota/include/i18n.h index 380913bfb..b7c139f1d 100644 --- a/tasmota/include/i18n.h +++ b/tasmota/include/i18n.h @@ -233,12 +233,10 @@ #define D_JSON_SIGNALSTRENGTH "SignalStrength" #define D_JSON_CHIPTEMPERATURE "ChipTemperature" #define D_JSON_RAW "Raw" -#define D_JSON_MX "Compass X-Axis" -#define D_JSON_MY "Compass Y-Axis" -#define D_JSON_MZ "Compass Z-Axis" -#define D_JSON_HEADING "Compass Heading" +#define D_JSON_MX "Induction X-Axis" +#define D_JSON_MY "Induction Y-Axis" +#define D_JSON_MZ "Induction Z-Axis" #define D_JSON_MAGNETICFLD "Magnetic Induction" - #define D_RSLT_ENERGY "ENERGY" #define D_RSLT_HASS_STATE "HASS_STATE" #define D_RSLT_INFO "INFO" diff --git a/tasmota/language/af_AF.h b/tasmota/language/af_AF.h index aa699bac0..66b21106f 100644 --- a/tasmota/language/af_AF.h +++ b/tasmota/language/af_AF.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Z-Axis" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Verwyder gewig" diff --git a/tasmota/language/bg_BG.h b/tasmota/language/bg_BG.h index a7ab9f6d2..ceaa474d5 100644 --- a/tasmota/language/bg_BG.h +++ b/tasmota/language/bg_BG.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Жироскоп - ос Z" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Премахване на тегло" diff --git a/tasmota/language/ca_AD.h b/tasmota/language/ca_AD.h index 591cf68f2..8e7140b5e 100644 --- a/tasmota/language/ca_AD.h +++ b/tasmota/language/ca_AD.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Z-Axis" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Treu el pes" diff --git a/tasmota/language/cs_CZ.h b/tasmota/language/cs_CZ.h index 2820a5fdb..9fd2f8248 100644 --- a/tasmota/language/cs_CZ.h +++ b/tasmota/language/cs_CZ.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro osa-Z" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Odstraňte zátěž" diff --git a/tasmota/language/de_DE.h b/tasmota/language/de_DE.h index e6ddf1712..956229518 100644 --- a/tasmota/language/de_DE.h +++ b/tasmota/language/de_DE.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyroskop Z-Achse" // xsns_33_QMC5883L.ino -#define D_MX "Kompass X-Achse" -#define D_MY "Kompass Y-Achse" -#define D_MZ "Kompass Z-Achse" -#define D_HG "Kompass Richtung" -#define D_MAGNETICFLD "Magnet Feld Stärke" +#define D_MX "Magnetfeld X-Achse" +#define D_MY "Magnetfeld Y-Achse" +#define D_MZ "Magnetfeld Z-Achse" +#define D_MAGNETICFLD "Magnetfeldstärke" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Wägegut entfernen" diff --git a/tasmota/language/el_GR.h b/tasmota/language/el_GR.h index 6a61a9db1..a4851ae11 100644 --- a/tasmota/language/el_GR.h +++ b/tasmota/language/el_GR.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Z-Axis" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Απομακρύνετε το βαρίδιο" diff --git a/tasmota/language/en_GB.h b/tasmota/language/en_GB.h index e20ffc432..e6ca68def 100644 --- a/tasmota/language/en_GB.h +++ b/tasmota/language/en_GB.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Z-Axis" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Remove weight" diff --git a/tasmota/language/es_ES.h b/tasmota/language/es_ES.h index 540a98cd6..ed4b489b3 100644 --- a/tasmota/language/es_ES.h +++ b/tasmota/language/es_ES.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Girós. Eje Z" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Remover Peso" diff --git a/tasmota/language/fr_FR.h b/tasmota/language/fr_FR.h index 7c3d2bc37..d6a430c41 100644 --- a/tasmota/language/fr_FR.h +++ b/tasmota/language/fr_FR.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Axe-Z" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Retirer la charge" diff --git a/tasmota/language/fy_NL.h b/tasmota/language/fy_NL.h index 613202110..a6208237a 100644 --- a/tasmota/language/fy_NL.h +++ b/tasmota/language/fy_NL.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Z-as" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Gewicht fuortsmite" diff --git a/tasmota/language/he_HE.h b/tasmota/language/he_HE.h index 1bf4a13f0..5216aac11 100644 --- a/tasmota/language/he_HE.h +++ b/tasmota/language/he_HE.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Z-Axis" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "הסר משקל" diff --git a/tasmota/language/hu_HU.h b/tasmota/language/hu_HU.h index 7509d2c9e..acd1c8b4f 100644 --- a/tasmota/language/hu_HU.h +++ b/tasmota/language/hu_HU.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Giroszkóp Z-tengely" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Távolítsa el a súlyt" diff --git a/tasmota/language/it_IT.h b/tasmota/language/it_IT.h index 81600584a..d4be235c9 100644 --- a/tasmota/language/it_IT.h +++ b/tasmota/language/it_IT.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Giroscopio asse Z" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Rimuovi peso" diff --git a/tasmota/language/ko_KO.h b/tasmota/language/ko_KO.h index 556f76192..807a8361c 100644 --- a/tasmota/language/ko_KO.h +++ b/tasmota/language/ko_KO.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Z-Axis" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "중량 제거" diff --git a/tasmota/language/nl_NL.h b/tasmota/language/nl_NL.h index 4614013aa..444f68ad1 100644 --- a/tasmota/language/nl_NL.h +++ b/tasmota/language/nl_NL.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Z-as" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Verwijder gewicht" diff --git a/tasmota/language/pl_PL.h b/tasmota/language/pl_PL.h index 070428d88..a42b55268 100644 --- a/tasmota/language/pl_PL.h +++ b/tasmota/language/pl_PL.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Odchylenie Oś-Z" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Usuń wagę" diff --git a/tasmota/language/pt_BR.h b/tasmota/language/pt_BR.h index 1a7e8e14a..91445badc 100644 --- a/tasmota/language/pt_BR.h +++ b/tasmota/language/pt_BR.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Giro Eixo-Z" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Remover calibragem" diff --git a/tasmota/language/pt_PT.h b/tasmota/language/pt_PT.h index 7b648706b..f05bded39 100644 --- a/tasmota/language/pt_PT.h +++ b/tasmota/language/pt_PT.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Z-Axis" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Remover peso" diff --git a/tasmota/language/ro_RO.h b/tasmota/language/ro_RO.h index 74f8b0b80..691aa97fe 100644 --- a/tasmota/language/ro_RO.h +++ b/tasmota/language/ro_RO.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Axa-Z" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Elimină greutatea" diff --git a/tasmota/language/ru_RU.h b/tasmota/language/ru_RU.h index 416354954..fb2e7c1bf 100644 --- a/tasmota/language/ru_RU.h +++ b/tasmota/language/ru_RU.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Z-Axis" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Remove weight" diff --git a/tasmota/language/sk_SK.h b/tasmota/language/sk_SK.h index 41865358e..429d93b3c 100644 --- a/tasmota/language/sk_SK.h +++ b/tasmota/language/sk_SK.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro os-Z" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Odstráňte záťaž" diff --git a/tasmota/language/sv_SE.h b/tasmota/language/sv_SE.h index 8ce2fc270..e4f1c79b2 100644 --- a/tasmota/language/sv_SE.h +++ b/tasmota/language/sv_SE.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Z-Axel" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Ta bort vikter" diff --git a/tasmota/language/tr_TR.h b/tasmota/language/tr_TR.h index 3be903a0a..d840fa46d 100644 --- a/tasmota/language/tr_TR.h +++ b/tasmota/language/tr_TR.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Z-Axis" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Remove weight" diff --git a/tasmota/language/uk_UA.h b/tasmota/language/uk_UA.h index 33962835f..dc0746fb9 100644 --- a/tasmota/language/uk_UA.h +++ b/tasmota/language/uk_UA.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Орієнт Вісь-Z" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Remove weight" diff --git a/tasmota/language/vi_VN.h b/tasmota/language/vi_VN.h index 6400fc55a..92b740fc4 100644 --- a/tasmota/language/vi_VN.h +++ b/tasmota/language/vi_VN.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "Gyro Z-Axis" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "Remove weight" diff --git a/tasmota/language/zh_CN.h b/tasmota/language/zh_CN.h index 297097b84..ccce4ca77 100644 --- a/tasmota/language/zh_CN.h +++ b/tasmota/language/zh_CN.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "绕Z轴旋转的角速度" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "去除重量" diff --git a/tasmota/language/zh_TW.h b/tasmota/language/zh_TW.h index b780ef98b..de5987d13 100644 --- a/tasmota/language/zh_TW.h +++ b/tasmota/language/zh_TW.h @@ -565,11 +565,10 @@ #define D_GZ_AXIS "陀螺儀 Z-軸" // xsns_33_QMC5883L.ino -#define D_MX "Compass X-Axis" -#define D_MY "Compass Y-Axis" -#define D_MZ "Compass Z-Axis" -#define D_HG "Compass Heading" -#define D_MAGNETICFLD "Magnetic Field Strength" +#define D_MX "Induction X-Axis" +#define D_MY "Induction Y-Axis" +#define D_MZ "Induction Z-Axis" +#define D_MAGNETICFLD "Magnetic Induction" // xsns_34_hx711.ino #define D_HX_CAL_REMOVE "移除重量" diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 92301bfc8..b3b76f260 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -715,8 +715,8 @@ // Reference: https://cdn-learn.adafruit.com/downloads/pdf/adafruit-led-backpack.pdf // #define SEVENSEG_ADDRESS1 0x70 // No longer used. Use MTX_ADDRESS1 - MTX_ADDRESS8 instead to specify I2C address of sevenseg displays // #define USE_DISPLAY_SH1106 // [DisplayModel 7] [I2cDriver6] Enable SH1106 Oled 128x64 display (I2C addresses 0x3C and 0x3D) - #define USE_QMC5883L // USE_QMC5883L compass sensor - #define USE_QMC5883L_Temp 22 // compass sensor temperatur are not calibrated (only relativ measurement) and need an absolute ground value in °C (see datasheet) + #define USE_QMC5883L // USE_QMC5883L magnetic induction sensor, (I2C address 0x0D) + #define QMC5883L_TEMP_SHIFT 23 // sensor temperature are not calibrated (only relativ measurement) and need an absolute ground value in °C (see datasheet) #endif // USE_I2C diff --git a/tasmota/tasmota_xsns_sensor/xsns_33_qmc5883l.ino b/tasmota/tasmota_xsns_sensor/xsns_33_qmc5883l.ino index 5f8878860..596311d2e 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_33_qmc5883l.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_33_qmc5883l.ino @@ -214,93 +214,50 @@ /* Mode values for the CONFIG2 register */ #define QMC5883L_CONFIG2_RESET 0b10000000 -/* Apparently M_PI isn't available in all environments. */ -#ifndef M_PI -#define M_PI 3.14159265358979323846264338327950288 -#endif + // data field +struct QMC5883L_s +{ + int16_t MX, MY, MZ; + int16_t temp; + uint16_t scalar; +} *QMC5883L = nullptr; -// data field -struct { -int16_t MX = 0, MY = 0, MZ = 0, HG = 0; -int16_t xhigh = 0, yhigh = 0, xlow = 0, ylow = 0; -int16_t temp = 0; -uint16_t scalar = 0; -uint8_t status; -bool ready = false; -uint8_t i2c_address = QMC5883L_ADDR; -} QMC5883L; // Initialise the device void QMC5883L_Init() { - if (!I2cSetDevice(QMC5883L.i2c_address)) { return; } - I2cSetActiveFound(QMC5883L.i2c_address, "QMC5883L"); + if (!I2cSetDevice(QMC5883L_ADDR)) + { + return; + } + I2cSetActiveFound(QMC5883L_ADDR, "QMC5883L"); // reset QMC5883L - if (I2cWrite8(QMC5883L.i2c_address, QMC5883L_CONFIG2, QMC5883L_CONFIG2_RESET) == false) return; // Software Reset - // writeRegister(QMC5883L_CONFIG2,QMC5883L_CONFIG2_RESET); // Software Reset - //writeRegister(QMC5883L_RESET, 0x01); - if (I2cWrite8(QMC5883L.i2c_address, QMC5883L_RESET, 0x01) == false) return; + if (I2cWrite8(QMC5883L_ADDR, QMC5883L_CONFIG2, QMC5883L_CONFIG2_RESET) == false) + return; // Software Reset + if (I2cWrite8(QMC5883L_ADDR, QMC5883L_RESET, 0x01) == false) + return; // write config - //writeRegister(QMC5883L_CONFIG, QMC5883L_CONFIG_OS256 | QMC5883L_CONFIG_8GAUSS | QMC5883L_CONFIG_10HZ | QMC5883L_CONFIG_CONT); - if (I2cWrite8(QMC5883L.i2c_address, QMC5883L_CONFIG, QMC5883L_CONFIG_OS256 | QMC5883L_CONFIG_8GAUSS | QMC5883L_CONFIG_10HZ | QMC5883L_CONFIG_CONT) == false) return; - QMC5883L.ready = true; + if (I2cWrite8(QMC5883L_ADDR, QMC5883L_CONFIG, QMC5883L_CONFIG_OS256 | QMC5883L_CONFIG_8GAUSS | QMC5883L_CONFIG_100HZ | QMC5883L_CONFIG_CONT) == false) + return; + QMC5883L = (QMC5883L_s*) calloc(1, sizeof(struct QMC5883L_s)); } //Read the magnetic data void QMC5883L_read_data(void) { - if(QMC5883L.ready != true) return; - uint8_t data = 0; // check if chip is ready to provice data - //if (!readRegister(QMC5883L_STATUS, 1)) return; // read error - if (!I2cValidRead8(&data, QMC5883L.i2c_address, QMC5883L_STATUS)) return; // read error - - //if (!(Wire.read() & QMC5883L_STATUS_DRDY)) return; // chip not yet ready, next round try again - if (!(data & QMC5883L_STATUS_DRDY)) return; // chip not yet ready, next round try again - - // QMC5883 reading data - //if (readRegister(QMC5883L_X_LSB, 6) != 6) return; // read error, select LSB register - //QMC5883L.MX = Wire.read() | (Wire.read() << 8); - //QMC5883L.MY = Wire.read() | (Wire.read() << 8); - //QMC5883L.MZ = Wire.read() | (Wire.read() << 8); + if (!(I2cRead8(QMC5883L_ADDR, QMC5883L_STATUS) & QMC5883L_STATUS_DRDY)) + return; // chip not yet ready, next round try again - int16_t x = 0; - int16_t y = 0; - - if (I2cValidReadS16(&x, QMC5883L.i2c_address, QMC5883L_X_LSB) == false) return; // read error, select LSB register - if (I2cValidReadS16(&y, QMC5883L.i2c_address, QMC5883L_Y_LSB) == false) return; // read error, select LSB register - if (I2cValidReadS16(&QMC5883L.MZ, QMC5883L.i2c_address, QMC5883L_Z_LSB) == false) return; // read error, select LSB register - - QMC5883L.MX = x; - QMC5883L.MY = y; - - // calculate azimut, heading - if(x < QMC5883L.xlow) QMC5883L.xlow = x; - if(x > QMC5883L.xhigh) QMC5883L.xhigh = x; - if(y < QMC5883L.ylow) QMC5883L.ylow = y; - if(y > QMC5883L.yhigh) QMC5883L.yhigh = y; - - /* Bail out if not enough data is available. */ - if( QMC5883L.xlow == QMC5883L.xhigh || QMC5883L.ylow == QMC5883L.yhigh ) return; - /* Recenter the measurement by subtracting the average */ - x -= (QMC5883L.xhigh + QMC5883L.xlow) / 2; - y -= (QMC5883L.yhigh + QMC5883L.ylow) / 2; - /* Rescale the measurement to the range observed. */ - float fx = (float) x / (QMC5883L.xhigh - QMC5883L.xlow); - float fy = (float) y / (QMC5883L.yhigh - QMC5883L.ylow); - - x = -atan2(fy, fx) * 180.0 / M_PI; - x += 180; // no negative numbers - QMC5883L.HG = x; + QMC5883L->MX = I2cReadS16_LE(QMC5883L_ADDR, QMC5883L_X_LSB); // select LSB register + QMC5883L->MY = I2cReadS16_LE(QMC5883L_ADDR, QMC5883L_Y_LSB); + QMC5883L->MZ = I2cReadS16_LE(QMC5883L_ADDR, QMC5883L_Z_LSB); // calculate scalar magnetic induction - QMC5883L.scalar = sqrt((QMC5883L.MX * QMC5883L.MX) + (QMC5883L.MY * QMC5883L.MY) + (QMC5883L.MZ * QMC5883L.MZ)); - - // get temperature - //if (readRegister(QMC5883L_TEMP_LSB, 2) != 2) return; // read error - if (I2cValidReadS16(&QMC5883L.temp, QMC5883L.i2c_address, QMC5883L_TEMP_LSB) == false) return; // read error, select LSB register - //t = Wire.read() | (Wire.read() << 8); - QMC5883L.temp = (QMC5883L.temp / 100) + USE_QMC5883L_Temp; + QMC5883L->scalar = sqrt((QMC5883L->MX * QMC5883L->MX) + (QMC5883L->MY * QMC5883L->MY) + (QMC5883L->MZ * QMC5883L->MZ)); + + // get temperature + QMC5883L->temp = (I2cReadS16_LE(QMC5883L_ADDR, QMC5883L_TEMP_LSB) / 100) + QMC5883L_TEMP_SHIFT; } /*********************************************************************************************\ @@ -313,7 +270,6 @@ const char HTTP_SNS_QMC5883L[] PROGMEM = "{s}QMC5883L " D_MY "{m}%d " D_UNIT_MICROTESLA "{e}" // {s} = , {m} = , {e} = "{s}QMC5883L " D_MZ "{m}%d " D_UNIT_MICROTESLA "{e}" // {s} = , {m} = , {e} = "{s}QMC5883L " D_MAGNETICFLD "{m}%d " D_UNIT_MICROTESLA "{e}" // {s} = , {m} = , {e} = - "{s}QMC5883L " D_HG "{m}%d " D_UNIT_DEGREE "{e}" // {s} = , {m} = , {e} = "{s}QMC5883L " D_TEMPERATURE "{m}%d " D_UNIT_DEGREE D_UNIT_CELSIUS "{e}"; // {s} = , {m} = , {e} = const char HTTP_SNS_QMC5883L_ERROR[] PROGMEM = @@ -325,27 +281,13 @@ void QMC5883L_Show(uint8_t json) { if (json) { - if (QMC5883L.ready != true) - { - AddLog(LOG_LEVEL_INFO, PSTR("QMC5883L: " D_ERROR " %x" ), QMC5883L.status); - return; - } - else - { - ResponseAppend_P(PSTR(",\"QMC5883L\":{\"" D_JSON_MX "\":%d,\"" D_JSON_MY "\":%d,\"" D_JSON_MZ "\":%d,\"" D_JSON_MAGNETICFLD "\":%u,\"" D_JSON_HEADING "\":%d,\"" D_JSON_TEMPERATURE "\":%d}"), QMC5883L.MX, QMC5883L.MY, QMC5883L.MZ, QMC5883L.scalar, QMC5883L.HG, QMC5883L.temp); - } + ResponseAppend_P(PSTR(",\"QMC5883L\":{\"" D_JSON_MX "\":%d,\"" D_JSON_MY "\":%d,\"" D_JSON_MZ "\":%d,\"" D_JSON_MAGNETICFLD "\":%u,\"" D_JSON_TEMPERATURE "\":%d}"), QMC5883L->MX, QMC5883L->MY, QMC5883L->MZ, QMC5883L->scalar, QMC5883L->temp); } #ifdef USE_WEBSERVER else { - if (QMC5883L.ready != true) - { - WSContentSend_PD(HTTP_SNS_QMC5883L_ERROR, D_ERROR); - } - else - { - WSContentSend_PD(HTTP_SNS_QMC5883L, QMC5883L.MX, QMC5883L.MY, QMC5883L.MZ, QMC5883L.scalar, QMC5883L.HG, QMC5883L.temp); - } + + WSContentSend_PD(HTTP_SNS_QMC5883L, QMC5883L->MX, QMC5883L->MY, QMC5883L->MZ, QMC5883L->scalar, QMC5883L->temp); } #endif } @@ -361,26 +303,22 @@ bool Xsns33(byte function) return false; } - if (FUNC_INIT == function) { - QMC5883L_Init(); - } - else - if (QMC5883L.ready == true) + switch (function) { - switch (function) - { - case FUNC_JSON_APPEND: - QMC5883L_Show(1); - break; - case FUNC_EVERY_SECOND: - QMC5883L_read_data(); - break; + case FUNC_INIT: + QMC5883L_Init(); + break; + case FUNC_JSON_APPEND: + QMC5883L_Show(1); + break; + case FUNC_EVERY_SECOND: + QMC5883L_read_data(); + break; #ifdef USE_WEBSERVER - case FUNC_WEB_SENSOR: - QMC5883L_Show(0); - break; + case FUNC_WEB_SENSOR: + QMC5883L_Show(0); + break; #endif // USE_WEBSERVER - } } return true; }