v2.0(beta) - added CHT832x

This commit is contained in:
pvvx 2024-11-22 14:56:19 +03:00
parent 94e7764794
commit 90b2eb964f
30 changed files with 21680 additions and 99 deletions

View file

@ -11,7 +11,7 @@
Прошивки работают с [Home Assistant](https://www.home-assistant.io/) и другим программным обеспечением, работающим в формате [BTHome](https://bthome.io/).
Все прошивки поддерживают любой из датчиков: CHT8215 (CHT8310), CHT8305, AHT20..30.
Все прошивки поддерживают любой из датчиков: [CHT8215](pvvx.github.io/THB2/CHT8315%20Advanced%20Datasheet%20Ver1.6%2020230927.pdf) ([CHT8310](https://pvvx.github.io/THB2/CHT8310%20Advanced%20Datasheet%20Ver1.1%2020230927.pdf)), [CHT8305](https://github.com/pvvx/pvvx.github.io/blob/master/THB2/CHT8305C%20Advanced%20Datasheet%20Ver2.5%202021-10-26.pdf), [CHT832x](pvvx.github.io/THB2/CHT832X%20Advanced%20Datasheet%20Ver1.pdf), AHT20..30.
* Программа для настройки и BLE OTA [PHY62x2BTHome.html](https://pvvx.github.io/THB2/web/PHY62x2BTHome.html).
* Подгрузка файлов OTA в [PHY62x2BTHome.html](https://pvvx.github.io/THB2/web/PHY62x2BTHome.html) производится автоматически - загружать из файлы из данного репозитория для OTA не требуется.
@ -38,13 +38,13 @@ _Далее, с помощью соединения BLE в [PHY62x2BTHome.html](
| [BTH01](https://pvvx.github.io/BTH01) | BOOT_BTH01_v19.hex | BTH01_v19.bin | нет |
| [TH05_V1.4](https://pvvx.github.io/TH-05) | BOOT_TH05_v19.hex | TH05_v19.bin | TH05_V1.4, TH05_V1.5, TH05_V1.6 с чипом BL55028 |
| [TH05_V1.3](https://pvvx.github.io/TH05-v1.3) | BOOT_TH05D_v19.hex | TH05D_v19.bin | RSH-TH05-V1.3 с чипом BL55072 |
| [TH05F](https://pvvx.github.io/TH05F) | BOOT_TH05F_v19.hex | TH05F_v19.bin | TH05Y_V1.1, TH05Y_V1.2 с чипом QD01 2332 NT |
| [TH05F](https://pvvx.github.io/TH05F) | BOOT_TH05F_v19.hex | TH05F_v19.bin | TH05Y_V1.1, TH05Y_V1.2, TH05Y_V3.1 с чипом QD01 2332 NT |
Основные файлы прошивок, BOOT_xxx_vxx.hex для программирования через USB-COM адаптер и xxx_vxx.bin для OTA, находятся в директории [bin](https://github.com/pvvx/THB2/tree/master/bin).
Файлы для обновления `FW Boot` по OTA находятся в директории [update_boot](https://github.com/pvvx/THB2/tree/master/update_boot). Процесс обновления `FW Boot` через OTA не является безопасным. Перед этим действием проверьте уровень батареи.
Актуальная версия `FW Boot` - **v1.9** для всех устройств (содержит исправления).
<ul><li>Актуальная версия `FW Boot` для TH05Y_V3.1 с датчиком CHT832x - **2.0**, для остальных - **v1.9**.</li></ul>
## Внутренняя распиновка GPIO:
@ -58,6 +58,10 @@ _Далее, с помощью соединения BLE в [PHY62x2BTHome.html](
| TH05D | P31/P32/- | P11/P14/- | P02 | - | P09 | P10 |
| TH05F | P33/P34/P00 | P26/P31/P02 | P14 | - | P20 | P18 |
Чип LCD во всех вариантах инициализируется одинаково, но разные порты подключения.
LCD имеет разную разводку сегментов в зависимости от модели.
Датчики опреляются автоматически, но имеют разные порты в зависимости от модели.
## Основные характеристики
! ри настройках по умолчанию_ !
@ -78,16 +82,17 @@ _Далее, с помощью соединения BLE в [PHY62x2BTHome.html](
| N | Описание |
|---|--- |
| 1.0 | Первая релизная версия |
| 1.1 | Добавлен триггер - вывод TX2 срабатывающий по установленным значениям температуры и/или влажности с гистерезисами. Передача состояния вывода RX2 при connect. Для термометров с экраном добавлен показ смайлика с "комфортом". Дополнены: изменение имени и MAC устройства. |
| 1.2 | Обработка и передача событий open/close со счетчиком с вывода маркированного "RX2" (для THB2 - "RX1"). |
| 1.3 | Добавлен THB1 и TH05V1.3. Следующий этап уменьшения потребления для версий с LCD дисплеем и опция отключения дисплея. |
| 1.4 | Стабилизация соединения для всех вариантов устройств. Добавлен [TH05F](https://pvvx.github.io/TH05F). Коррекция хода RTC. Изменено BLE имя для TH05_V1.3 на "TH05D". Добавлены файлы для обновления Boot по OTA. |
| 1.5 | Добавлен вариант шифрования BLE рекламы с помощью BindKey. |
| 1.6 | Добавлено усреднение расчета напряжения батареи, дублирование состояния контакта open/close и счетчика через 12..20 сек (кратно интервалу рекламы) после срабатывания и далее каждые 30 минут. |
| 1.7 | Исправление ошибки (> 42 C) для сенсора CHT8305 |
| 1.8 | Добавлено отображение температуры в градусах Фаренгейта |
| 1.9 | Исправлена ошибка восстановления измененного имени устройства после сброса питания |
| 1.0 | <ul><li>Первая релизная версия</li></ul> |
| 1.1 | <ul><li>Добавлен триггер - вывод TX2 срабатывающий по установленным значениям температуры и/или влажности с гистерезисами. Передача состояния вывода RX2 при connect. Для термометров с экраном добавлен показ смайлика с "комфортом". Дополнены: изменение имени и MAC устройства.</li></ul> |
| 1.2 | <ul><li>Обработка и передача событий open/close со счетчиком с вывода маркированного "RX2" (для THB2 - "RX1").</li></ul> |
| 1.3 | <ul><li>Добавлен THB1 и TH05V1.3. Следующий этап уменьшения потребления для версий с LCD дисплеем и опция отключения дисплея.</li></ul> |
| 1.4 | <ul><li>Стабилизация соединения для всех вариантов устройств. Добавлен [TH05F](https://pvvx.github.io/TH05F). Коррекция хода RTC. Изменено BLE имя для TH05_V1.3 на "TH05D". Добавлены файлы для обновления Boot по OTA.</li></ul> |
| 1.5 | <ul><li>Добавлен вариант шифрования BLE рекламы с помощью BindKey.</li></ul> |
| 1.6 | <ul><li>Добавлено усреднение расчета напряжения батареи, дублирование состояния контакта open/close и счетчика через 12..20 сек (кратно интервалу рекламы) после срабатывания и далее каждые 30 минут.</li></ul> |
| 1.7 | <ul><li>Исправление ошибки (> 42 C) для сенсора CHT8305</li></ul> |
| 1.8 | <ul><li>Добавлено отображение температуры в градусах Фаренгейта</li></ul> |
| 1.9 | <ul><li>Исправлена ошибка восстановления измененного имени устройства после сброса питания</li></ul> |
| 2.0beta | <ul><li>Добавлена обработка датчика CHT832x (поддержка платы TH05Y_v3.1)</li></ul> |
## Прошивка

View file

@ -11,7 +11,7 @@ Custom firmware for Tuya devices based on the PHY622x2 chipset.
This firmware works with [Home Assistant](https://www.home-assistant.io/) and other software running in the [BTHome](https://bthome.io/) format.
All firmware supports any of these sensors: CHT8215 (CHT8310), CHT8305, AHT20..30.
All firmware supports any of these sensors: [CHT8215](pvvx.github.io/THB2/CHT8315%20Advanced%20Datasheet%20Ver1.6%2020230927.pdf) ([CHT8310](https://pvvx.github.io/THB2/CHT8310%20Advanced%20Datasheet%20Ver1.1%2020230927.pdf)), [CHT8305](https://github.com/pvvx/pvvx.github.io/blob/master/THB2/CHT8305C%20Advanced%20Datasheet%20Ver2.5%202021-10-26.pdf), [CHT832x](pvvx.github.io/THB2/CHT832X%20Advanced%20Datasheet%20Ver1.pdf), AHT20..30.
**Software for setting up and making BLE OTA: [PHY62x2BTHome.html](https://pvvx.github.io/THB2/web/PHY62x2BTHome.html).**
> Uploading OTA files to [PHY62x2BTHome.html](https://pvvx.github.io/THB2/web/PHY62x2BTHome.html) is automatic. You don't need to download files from this repository for OTA.
@ -39,13 +39,13 @@ The [Boot](#fw-boot-and-ota) firmware has minimal functions. `FW Boot` is only u
| [BTH01](https://pvvx.github.io/BTH01) | BOOT_BTH01_v19.hex | BTH01_v19.bin | no |
| [TH05_V1.4](https://pvvx.github.io/TH-05) | BOOT_TH05_v19.hex | TH05_v19.bin | TH05_V1.4, TH05_V1.5, TH05_V1.6 (chip: BL55028) |
| [TH05_V1.3](https://pvvx.github.io/TH05-v1.3) | BOOT_TH05D_v19.hex | TH05D_v19.bin | RSH-TH05-V1.3 (chip: BL55072) |
| [TH05F](https://pvvx.github.io/TH05F) | BOOT_TH05F_v19.hex | TH05F_v19.bin | TH05Y_V1.1, TH05Y_V1.2 (chip: QD01 2332 NT) |
| [TH05F](https://pvvx.github.io/TH05F) | BOOT_TH05F_v19.hex | TH05F_v19.bin | TH05Y_V1.1, TH05Y_V1.2, TH05Y_V3.1 (chip: QD01 2332 NT) |
The main firmware files, BOOT_XXX_vXX.hex (for programming via USB-COM adapter) and XXX_vXX.bin (for OTA), are located in the [bin](bin) directory.
Files for updating boot via OTA are located in the [update_boot](update_boot) directory. **
> The current `FW Boot' version is **v1.9** for all devices (errors fixed).
> The current version of `FW Boot` for TH05Y_V3.1 with CHT832x sensor is **2.0**, for the rest - **v1.9**.
## Internal GPIO pinout:
@ -59,6 +59,10 @@ Files for updating boot via OTA are located in the [update_boot](update_boot) di
| TH05D | P31/P32/- | P11/P14/- | P02 | - | P09 | P10 |
| TH05F | P33/P34/P00 | P26/P31/P02 | P14 | - | P20 | P18 |
The LCD chip is initialized the same way in all variants, but the connection ports are different.
The LCD has different segment layouts depending on the model.
The sensors are detected automatically, but have different ports depending on the model.
## Main features
**With default settings**:
@ -90,6 +94,7 @@ Files for updating boot via OTA are located in the [update_boot](update_boot) di
| 1.7 | <ul><li>Fixed en error (> 42 C) for sensor CHT8305</li></ul> |
| 1.8 | <ul><li>Added display of temperature in degrees Fahrenheit</li></ul> |
| 1.9 | <ul><li>Fixed the bug of restoring the changed device name after power reset</li></ul> |
| 2.0beta | <ul><li>Added processing of the CHT832x sensor (Support board TH05Y_v3.1)</li></ul> |
## Firmware

3021
bin/BOOT_BTH01_v20.hex Normal file

File diff suppressed because it is too large Load diff

3092
bin/BOOT_TH05D_v20.hex Normal file

File diff suppressed because it is too large Load diff

3089
bin/BOOT_TH05F_v20.hex Normal file

File diff suppressed because it is too large Load diff

3087
bin/BOOT_TH05_v20.hex Normal file

File diff suppressed because it is too large Load diff

3083
bin/BOOT_THB1_v20.hex Normal file

File diff suppressed because it is too large Load diff

3018
bin/BOOT_THB2_v20.hex Normal file

File diff suppressed because it is too large Load diff

3083
bin/BOOT_THB3_v20.hex Normal file

File diff suppressed because it is too large Load diff

BIN
bin/BTH01_v20.bin Normal file

Binary file not shown.

BIN
bin/TH05D_v20.bin Normal file

Binary file not shown.

BIN
bin/TH05F_v20.bin Normal file

Binary file not shown.

BIN
bin/TH05_v20.bin Normal file

Binary file not shown.

BIN
bin/THB1_v20.bin Normal file

Binary file not shown.

BIN
bin/THB2_v20.bin Normal file

Binary file not shown.

BIN
bin/THB3_v20.bin Normal file

Binary file not shown.

View file

@ -1,5 +1,5 @@
@set PATH=D:\MCU\GNU_Tools_ARM_Embedded\13.2.rel1\bin;%PATH%
@set SWVER=_v19
@set SWVER=_v20
@del /Q "build\THB2%SWVER%.hex"
@del /Q "build\THB2%SWVER%.bin"
@mkdir .\bin

View file

@ -123,6 +123,7 @@ int read_i2c_bytes(pdev_i2c_t pi2c_dev, uint8 addr, uint8 reg, uint8 * data, uin
return 0;
}
/* size max = 7 ! */
int read_i2c_nabuf(pdev_i2c_t pi2c_dev, uint8 addr, uint8 * data, uint8 size) {
AP_I2C_TypeDef* pi2cdev = pi2c_dev->pi2cdev;
int i = size;
@ -130,6 +131,7 @@ int read_i2c_nabuf(pdev_i2c_t pi2c_dev, uint8 addr, uint8 * data, uint8 size) {
pi2cdev->IC_TAR = addr;
HAL_ENTER_CRITICAL_SECTION();
pi2cdev->IC_ENABLE = 1;
while(i--)
pi2cdev->IC_DATA_CMD = 0x100;
@ -150,15 +152,7 @@ int read_i2c_nabuf(pdev_i2c_t pi2c_dev, uint8 addr, uint8 * data, uint8 size) {
return 0;
}
int send_i2c_byte(pdev_i2c_t pi2c_dev, uint8 addr, uint8 data) {
AP_I2C_TypeDef* pi2cdev = pi2c_dev->pi2cdev;
pi2cdev->IC_ENABLE = 0;
pi2cdev->IC_TAR = addr;
HAL_ENTER_CRITICAL_SECTION();
pi2cdev->IC_ENABLE = 1;
pi2cdev->IC_DATA_CMD = data;
// while(!(pi2cdev->IC_RAW_INTR_STAT & 0x10));
HAL_EXIT_CRITICAL_SECTION();
static int i2c_wait_send(AP_I2C_TypeDef* pi2cdev) {
uint32 to = osal_sys_tick;
while(1) {
if(pi2cdev->IC_RAW_INTR_STAT & 0x200)// check tx empty
@ -169,45 +163,72 @@ int send_i2c_byte(pdev_i2c_t pi2c_dev, uint8 addr, uint8 data) {
return 0;
}
int send_i2c_byte(pdev_i2c_t pi2c_dev, uint8 addr, uint8 data) {
AP_I2C_TypeDef* pi2cdev = pi2c_dev->pi2cdev;
pi2cdev->IC_ENABLE = 0;
pi2cdev->IC_TAR = addr;
HAL_ENTER_CRITICAL_SECTION();
pi2cdev->IC_ENABLE = 1;
pi2cdev->IC_DATA_CMD = data;
// while(!(pi2cdev->IC_RAW_INTR_STAT & 0x10));
HAL_EXIT_CRITICAL_SECTION();
return i2c_wait_send(pi2cdev);
}
int send_i2c_wreg(pdev_i2c_t pi2c_dev, uint8 addr, uint8 reg, uint16 data) {
AP_I2C_TypeDef* pi2cdev = pi2c_dev->pi2cdev;
pi2cdev->IC_ENABLE = 0;
pi2cdev->IC_TAR = addr;
HAL_ENTER_CRITICAL_SECTION();
pi2cdev->IC_ENABLE = 1;
pi2cdev->IC_DATA_CMD = reg;
while(!(pi2cdev->IC_RAW_INTR_STAT & 0x10));
pi2cdev->IC_DATA_CMD = (data >> 8) & 0xff;
while(!(pi2cdev->IC_RAW_INTR_STAT & 0x10));
pi2cdev->IC_DATA_CMD = data & 0xff;
HAL_EXIT_CRITICAL_SECTION();
uint32 to = osal_sys_tick;
while(1) {
if(pi2cdev->IC_RAW_INTR_STAT & 0x200)// check tx empty
break;
if(osal_sys_tick - to > I2C_WAIT_ms)
return 1;
}
return 0;
return i2c_wait_send(pi2cdev);
}
int send_i2c_wcmd(pdev_i2c_t pi2c_dev, uint8 addr, uint16 cmd) {
AP_I2C_TypeDef* pi2cdev = pi2c_dev->pi2cdev;
pi2cdev->IC_ENABLE = 0;
pi2cdev->IC_TAR = addr;
HAL_ENTER_CRITICAL_SECTION();
pi2cdev->IC_ENABLE = 1;
pi2cdev->IC_DATA_CMD = (cmd >> 8) & 0xff;
while(!(pi2cdev->IC_RAW_INTR_STAT & 0x10));
pi2cdev->IC_DATA_CMD = cmd & 0xff;
HAL_EXIT_CRITICAL_SECTION();
return i2c_wait_send(pi2cdev);
}
int send_i2c_buf(pdev_i2c_t pi2c_dev, uint8 addr, uint8 * pdata, int len) {
AP_I2C_TypeDef* pi2cdev = pi2c_dev->pi2cdev;
pi2cdev->IC_ENABLE = 0;
pi2cdev->IC_TAR = addr;
HAL_ENTER_CRITICAL_SECTION();
pi2cdev->IC_ENABLE = 1;
while(len--) {
pi2cdev->IC_DATA_CMD = *pdata++;
while(!(pi2cdev->IC_RAW_INTR_STAT & 0x10));
}
HAL_EXIT_CRITICAL_SECTION();
uint32 to = osal_sys_tick;
while(1) {
if(pi2cdev->IC_RAW_INTR_STAT & 0x200)// check tx empty
break;
if(osal_sys_tick - to > I2C_WAIT_ms)
return 1;
}
return 0;
return i2c_wait_send(pi2cdev);
}

View file

@ -25,6 +25,7 @@ void init_i2c(pdev_i2c_t pi2c_dev);
void deinit_i2c(pdev_i2c_t pi2c_dev);
int send_i2c_byte(pdev_i2c_t pi2c_dev, uint8_t addr, uint8_t data);
int send_i2c_wreg(pdev_i2c_t pi2c_dev, uint8 addr, uint8 reg, uint16 data);
int send_i2c_wcmd(pdev_i2c_t pi2c_dev, uint8 addr, uint16 cmd);
int send_i2c_buf(pdev_i2c_t pi2c_dev, uint8 addr, uint8 * pdata, int len);
int read_i2c_bytes(pdev_i2c_t pi2c_dev, uint8 addr, uint8 reg, uint8 * data, uint8 size);
int read_i2c_nabuf(pdev_i2c_t pi2c_dev, uint8 addr, uint8 * data, uint8 size);

View file

@ -27,6 +27,14 @@ dev_i2c_t i2c_dev0 = {
thsensor_cfg_t thsensor_cfg;
const thsensor_def_cfg_t def_thcoef_cht8320 = {
.coef.temp_k = 17500,
.coef.humi_k = 10000,
.coef.temp_z = -4500,
.coef.humi_z = 0,
.sensor_type = TH_SENSOR_CHT832x
};
const thsensor_def_cfg_t def_thcoef_cht8215 = {
.coef.temp_k = 25606,
.coef.humi_k = 20000,
@ -80,6 +88,19 @@ int read_sensor_cht821x(pdev_i2c_t pi2c_dev) {
return 1;
}
int read_sensor_cht832x(pdev_i2c_t pi2c_dev) {
uint32_t _r32;
uint8_t reg_data[6];
if (read_i2c_nabuf(pi2c_dev, thsensor_cfg.i2c_addr, reg_data, 6) == 0) {
_r32 = (reg_data[0] << 8) | reg_data[1];
measured_data.temp = ((uint32_t)(_r32 * thsensor_cfg.coef.temp_k) >> 16) + thsensor_cfg.coef.temp_z;; // x 0.01 C
_r32 = ((reg_data[3] << 8) | reg_data[4]);
measured_data.humi = ((uint32_t)(_r32 * thsensor_cfg.coef.humi_k) >> 16) + thsensor_cfg.coef.humi_z; // x 0.01 %
return 0;
}
return 1;
}
int read_sensor_ahtxx(pdev_i2c_t pi2c_dev) {
uint32_t _temp;
uint8_t reg_data[8];
@ -131,20 +152,38 @@ void start_measure(void) {
send_i2c_byte(&i2c_dev0, thsensor_cfg.i2c_addr, CHT83xx_REG_TMP); // start measure T/H
deinit_i2c(&i2c_dev0);
}
else if(thsensor_cfg.vid == CHT832x_VID) {
init_i2c(&i2c_dev0);
send_i2c_wcmd(&i2c_dev0, thsensor_cfg.i2c_addr, CHT832x_CMD_OSM); // start measure T/H
deinit_i2c(&i2c_dev0);
}
}
}
__ATTR_SECTION_XIP__
void init_sensor(void) {
thsensor_def_cfg_t * init_cht83xx_sensor(void) {
thsensor_def_cfg_t *ptabinit = NULL;
thsensor_cfg.read_sensor = NULL;
thsensor_cfg.sensor_type = TH_SENSOR_NONE;
init_i2c(&i2c_dev0);
//send_i2c_byte(0,6);
thsensor_cfg.i2c_addr = CHT83xx_I2C_ADDR;
if(!read_i2c_bytes(&i2c_dev0, thsensor_cfg.i2c_addr, CHT83xx_REG_MID, (uint8 *)&thsensor_cfg.mid, 2) // 0x5959
&& !read_i2c_bytes(&i2c_dev0, thsensor_cfg.i2c_addr, CHT83xx_REG_VID, (uint8 *)&thsensor_cfg.vid, 2)) { // 0x8215
// test cht832x
#if 1
uint32_t tmp = 0;
if((!send_i2c_wcmd(&i2c_dev0, thsensor_cfg.i2c_addr, CHT832x_CMD_MID))
&& (!read_i2c_nabuf(&i2c_dev0, thsensor_cfg.i2c_addr, (uint8 *)&tmp, 3))
&& tmp == CHT832x_MID_CRC) {
thsensor_cfg.mid = (uint16_t)tmp;
#else
if((!send_i2c_wcmd(&i2c_dev0, thsensor_cfg.i2c_addr, CHT832x_CMD_MID))
&& (!read_i2c_nabuf(&i2c_dev0, thsensor_cfg.i2c_addr, (uint8_t *)&thsensor_cfg.mid, 3))
&& thsensor_cfg.mid == CHT83xx_MID) {
#endif
thsensor_cfg.vid = CHT832x_VID;
ptabinit = (thsensor_def_cfg_t *)&def_thcoef_cht8320;
thsensor_cfg.read_sensor = read_sensor_cht832x;
}
// test CHT8305, CHT8315...
else if(!read_i2c_bytes(&i2c_dev0, thsensor_cfg.i2c_addr, CHT83xx_REG_MID, (uint8 *)&thsensor_cfg.mid, 2)) { // 0x5959
if(thsensor_cfg.mid == CHT83xx_MID) {
if(!read_i2c_bytes(&i2c_dev0, thsensor_cfg.i2c_addr, CHT83xx_REG_VID, (uint8 *)&thsensor_cfg.vid, 2)) { // 0x8215
if(thsensor_cfg.vid == CHT8305_VID) {
#if 0 // USE_DEFAULT_SETS_SENSOR
// Soft reset command
@ -163,9 +202,28 @@ void init_sensor(void) {
ptabinit = (thsensor_def_cfg_t *)&def_thcoef_cht8215;
thsensor_cfg.read_sensor = read_sensor_cht821x;
}
} else
thsensor_cfg.i2c_addr = 0;
} else {
}
}
}
return ptabinit;
}
__ATTR_SECTION_XIP__
void init_sensor(void) {
thsensor_def_cfg_t *ptabinit = NULL;
thsensor_cfg.read_sensor = NULL;
thsensor_cfg.sensor_type = TH_SENSOR_NONE;
init_i2c(&i2c_dev0);
//send_i2c_byte(0,6);
thsensor_cfg.i2c_addr = CHT8215_I2C_ADDR0;
while(thsensor_cfg.i2c_addr < CHT8215_I2C_ADDR3) {
ptabinit = init_cht83xx_sensor();
if(ptabinit != NULL)
break;
thsensor_cfg.i2c_addr += CHT8215_I2C_ADDR1 - CHT8215_I2C_ADDR0;
}
if(ptabinit == NULL) {
thsensor_cfg.i2c_addr = AHT2x_I2C_ADDR;
if(!send_i2c_wreg(&i2c_dev0, thsensor_cfg.i2c_addr, AHT2x_CMD_TMS, AHT2x_DATA_TMS)) {
ptabinit = (thsensor_def_cfg_t *)&def_thcoef_aht30;

View file

@ -25,8 +25,15 @@
#define CHT83xx_MID 0x5959
/* CHT832x https://github.com/pvvx/pvvx.github.io/blob/master/THB2/CHT832X Advanced Datasheet Ver1.pdf */
/* CHT8310 https://github.com/pvvx/pvvx.github.io/blob/master/THB2/CHT8310.Advanced.Datasheet_Ver1.0.20230407.pdf */
#define CHT832x_CMD_MID 0x3781 // Read Manufacturer ID
#define CHT832x_MID_CRC 0x535959 // CRC, MID
#define CHT832x_VID 0x2083 // VID
#define CHT832x_CMD_OSM 0x2400 // start measure T/H (One-shot mode)
/* CHT8310 https://github.com/pvvx/pvvx.github.io/blob/master/THB2/CHT8310 Advanced Datasheet Ver1.1 20230927.pdf */
/* CHT8315 https://github.com/pvvx/pvvx.github.io/blob/master/THB2/CHT8315 Advanced Datasheet Ver1.6 20230927.pdf */
// I2C addres
#define CHT8215_I2C_ADDR0 0x40
@ -71,7 +78,8 @@
#define CHT8315_MID 0x5959
#define CHT8215_VID 0x1582
/* CHT8305 https://github.com/pvvx/pvvx.github.io/blob/master/BTH01/CHT8305.pdf */
/* CHT8305 https://github.com/pvvx/pvvx.github.io/blob/master/THB2/CHT8305C Advanced Datasheet Ver2.5 2021-10-26.pdf */
// I2C addres
#define CHT8305_I2C_ADDR0 0x40
@ -144,6 +152,7 @@ enum {
TH_SENSOR_CHT8305, // 4
TH_SENSOR_AHT2x, // 5
TH_SENSOR_CHT8215, // 6
TH_SENSOR_CHT832x, // 6
TH_SENSOR_TYPE_MAX // 7
}; // TH_SENSOR_TYPES

View file

@ -579,7 +579,7 @@ div#divChart {
UPDATE: { en: 'Update', ru: 'Обновление' },
TRIGGER_DATA: { en: 'Trigger settings line', ru: 'Строка настроек триггера' },
COMFORT_TEMPERATURE: { en: 'Comfort temperature', ru: 'Комфорт Температура' },
DEVICE: { en: 'Device', ru: 'Устройство' },
DEVICE: { en: 'Device MAC', ru: 'MAC устройства' },
COMMAND_RESPONSE: { en: 'Command response', ru: 'Ответ на команду' },
SET_DEVICE_TIME: { en: 'Set device time', ru: 'Установка времени на устройстве' },
TIME_IS_SYNCED: { en: 'Device time is synchronized', ru: 'Время на устройстве синхронизировано' },
@ -1738,7 +1738,7 @@ function parseBlkCustom(value) {
mac[5] = value.getUint8(1);
let mac_txt = bytesToHex(mac);
$("inpDevMAC").value = mac_txt;
addLog(`${i18n.getTag('DEVICE')} MAC : ${mac_txt}`);
addLog(`${i18n.getTag('DEVICE_MAC')}: ${mac_txt}`);
} else {
console.log('blk: ' + dump8(value, value.byteLength));
addLog(`${i18n.getTag('COMMAND_RESPONSE')} (${hex(blkId,2)}): ${bytesToHex(value.buffer.slice(1))}`);

25
fw.json
View file

@ -1,4 +1,13 @@
{"custom":[
{"betafw":[
"bin/THB2_v20.bin",
"bin/BTH01_v20.bin",
"bin/TH05_v20.bin",
"?",
"bin/THB1_v20.bin",
"bin/TH05D_v20.bin",
"bin/TH05F_v20.bin",
"bin/THB3_v20.bin"],
"custom":[
"bin/THB2_v19.bin",
"bin/BTH01_v19.bin",
"bin/TH05_v19.bin",
@ -8,12 +17,12 @@
"bin/TH05F_v19.bin",
"bin/THB3_v19.bin"],
"updateboot":[
"update_boot/BOOT_THB2_v19.bin",
"update_boot/BOOT_BTH01_v19.bin",
"update_boot/BOOT_TH05_v19.bin",
"update_boot/BOOT_THB2_v20.bin",
"update_boot/BOOT_BTH01_v20.bin",
"update_boot/BOOT_TH05_v20.bin",
"?",
"update_boot/BOOT_THB1_v19.bin",
"update_boot/BOOT_TH05D_v19.bin",
"update_boot/BOOT_TH05F_v19.bin",
"update_boot/BOOT_THB3_v19.bin"]
"update_boot/BOOT_THB1_v20.bin",
"update_boot/BOOT_TH05D_v20.bin",
"update_boot/BOOT_TH05F_v20.bin",
"update_boot/BOOT_THB3_v20.bin"]
}

View file

@ -1,2 +1,2 @@
python3 rdwr_phy62x2.py -p COM12 -e -r wh ./bin/BOOT_BTH01_v19.hex
@rem python3 rdwr_phy62x2.py -p COM12 -r we 0x10000 ./bin/BTH01_v19.bin
python3 rdwr_phy62x2.py -p COM8 -e -r wh ./bin/BOOT_BTH01_v20.hex
@rem python3 rdwr_phy62x2.py -p COM12 -r we 0x10000 ./bin/BTH01_v20.bin

View file

@ -1,2 +1,2 @@
python3 rdwr_phy62x2.py -p COM11 -e -r wh ./bin/BOOT_TH05_v19.hex
@rem python3 rdwr_phy62x2.py -p COM11 -r we 0x10000 ./bin/TH05_v19.bin
python3 rdwr_phy62x2.py -p COM8 -e -r wh ./bin/BOOT_TH05_v20.hex
@rem python3 rdwr_phy62x2.py -p COM11 -r we 0x10000 ./bin/TH05_v20.bin

View file

@ -1,2 +1,2 @@
python3 rdwr_phy62x2.py -p COM11 -e -r wh ./bin/BOOT_TH05D_v19.hex
@rem python3 rdwr_phy62x2.py -p COM11 -r we 0x10000 ./bin/TH05D_v19.bin
python3 rdwr_phy62x2.py -p COM11 -e -r wh ./bin/BOOT_TH05D_v20.hex
@rem python3 rdwr_phy62x2.py -p COM11 -r we 0x10000 ./bin/TH05D_v20.bin

View file

@ -1,2 +1,2 @@
python3 rdwr_phy62x2.py -p COM11 -e -r wh ./bin/BOOT_TH05F_v19.hex
@rem python3 rdwr_phy62x2.py -p COM11 -r we 0x10000 ./bin/TH05F_v19.bin
python3 rdwr_phy62x2.py -p COM8 -e -r wh ./bin/BOOT_TH05F_v20.hex
@rem python3 rdwr_phy62x2.py -p COM11 -r we 0x10000 ./bin/TH05F_v20.bin

View file

@ -1,2 +1,2 @@
python3 rdwr_phy62x2.py -p COM11 -e -r wh ./bin/BOOT_THB1_v19.hex
@rem python3 rdwr_phy62x2.py -p COM11 -r we 0x10000 ./bin/THB1_v19.bin
python3 rdwr_phy62x2.py -p COM8 -e -r wh ./bin/BOOT_THB1_v20.hex
@rem python3 rdwr_phy62x2.py -p COM11 -r we 0x10000 ./bin/THB1_v20.bin

View file

@ -1,2 +1,2 @@
python3 rdwr_phy62x2.py -p COM12 -e -r wh ./bin/BOOT_THB2_v19.hex
@rem python3 rdwr_phy62x2.py -p COM12 -r we 0x10000 ./bin/THB2_v19.bin
python3 rdwr_phy62x2.py -p COM8 -e -r wh ./bin/BOOT_THB2_v20.hex
@rem python3 rdwr_phy62x2.py -p COM12 -r we 0x10000 ./bin/THB2_v20.bin

View file

@ -1,2 +1,2 @@
python3 rdwr_phy62x2.py -p COM11 -e -r wh ./bin/BOOT_THB3_v19.hex
@rem python3 rdwr_phy62x2.py -p COM11 -r we 0x10000 ./bin/THB3_v19.bin
python3 rdwr_phy62x2.py -p COM8 -e -r wh ./bin/BOOT_THB3_v20.hex
@rem python3 rdwr_phy62x2.py -p COM11 -r we 0x10000 ./bin/THB3_v20.bin