ahtx0温湿度到系统温湿度

This commit is contained in:
sc committed 2025-12-28 20:21:55 +08:00
1 parent 7a3b64472d
commit 823153c8ea
3 files changed
+14 -7

No files matched your search

+4 -6
View File
@@ -134,7 +134,9 @@ static void aht20_parse_data(const rt_uint8_t raw[6], rt_int32_t *temp, rt_int32
static void aht20_thread_entry(void *parameter)
{
rt_uint8_t raw_data[6];
rt_int32_t temperature, humidity;
extern unsigned int sys_temperature;
extern unsigned int sys_humidity;
while (1)
{
@@ -162,11 +164,7 @@ static void aht20_thread_entry(void *parameter)
continue;
}
aht20_parse_data(raw_data, &temperature, &humidity);
LOG_I("Temp: %d.%dC, Humidity: %d.%dRH",
temperature / 10, temperature % 10,
humidity / 10, humidity % 10);
aht20_parse_data(raw_data, &sys_temperature, &sys_humidity);
rt_thread_mdelay(5000); // 每 2 秒读取一次
}