From ecf7d444c667b69192b434ea1171439270c224d1 Mon Sep 17 00:00:00 2001 From: legchenkov <144897723+legchenkov@users.noreply.github.com> Date: Sun, 28 Apr 2024 21:34:36 +0200 Subject: [PATCH] Add Support for AHT30 Temperature and Humidity Sensor (#19922) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update xsns_63_aht1x.ino Support for AHT30 added. Fixed command for loading factory calibrated data and reset command, added needed delay after read command and increased measurement period to reduce heating of sensor. * Update xsns_63_aht1x.ino * Update xsns_63_aht1x.ino The reset command is aligned with the AHT10/20/30 datasheet. * Update ru_RU.h Translated Dew Point to russian Точка росы for sensors * Delete tasmota/language/ru_RU.h Will go to separate PR * Add files via upload * Update ru_RU.h Partial translation update * Add files via upload --- tasmota/tasmota_xsns_sensor/xsns_63_aht1x.ino | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tasmota/tasmota_xsns_sensor/xsns_63_aht1x.ino b/tasmota/tasmota_xsns_sensor/xsns_63_aht1x.ino index 7a9397f0ebe5..976d84b3f964 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_63_aht1x.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_63_aht1x.ino @@ -19,7 +19,7 @@ */ #ifdef USE_I2C -#if defined(USE_AHT1x) || defined(USE_AHT2x) +#if defined(USE_AHT1x) || defined(USE_AHT2x) || defined(USE_AHT3x) /*********************************************************************************************\ * AHT10/15/20 - Temperature and Humidity @@ -40,7 +40,10 @@ * and allows other I2C Devices on the bus but have only one I2C Address (0x38) * 14.09.2021 support AHT20 without enabling AHT1x * + * 26.10.2023 support for AHT30 added. + * * AHT20 I2C Address: 0x38 + * AHT30 I2C Address: 0x38 \*********************************************************************************************/ #define XSNS_63 63 @@ -56,12 +59,15 @@ #define AHT_TEMPERATURE_OFFSET 50 #define KILOBYTE_CONST 1048576.0f -#define AHT1X_CMD_DELAY 40 -#define AHT1X_RST_DELAY 30 +#define AHT1X_CMD_DELAY 20 +#define AHT1X_RST_DELAY 10 #define AHT1X_MEAS_DELAY 80 // over 75ms in datasheet -#ifdef USE_AHT2x - #define AHTX_CMD 0xB1 // Cmd for AHT2x +#ifdef USE_AHT3x + #define AHTX_CMD 0xBE // Cmd for AHT3x + const char ahtTypes[] PROGMEM = "AHT3X|AHT3X"; +#elif defined(USE_AHT2x) + #define AHTX_CMD 0xBE // Cmd for AHT2x const char ahtTypes[] PROGMEM = "AHT2X|AHT2X"; #else #define AHTX_CMD 0xE1 // Cmd for AHT1x @@ -92,6 +98,7 @@ bool AHT1XWrite(uint8_t aht1x_idx) { Wire.write(AHTMeasureCmd, 3); if (Wire.endTransmission() != 0) return false; + delay(AHT1X_MEAS_DELAY); return true; } @@ -198,7 +205,7 @@ bool Xsns63(uint32_t function) } else if (aht1x.count) { switch (function) { - case FUNC_EVERY_100_MSECOND: + case FUNC_EVERY_SECOND: AHT1XPoll(); break; case FUNC_JSON_APPEND: @@ -215,4 +222,4 @@ bool Xsns63(uint32_t function) } #endif // USE_AHT1X -#endif // USE_I2C \ No newline at end of file +#endif // USE_I2C