feat: 添加 AHT30 温湿度传感器支持,优化 I2C 传感器管理逻辑

This commit is contained in:
Wang Beihong
2026-03-06 10:32:18 +08:00
parent bde2df4e13
commit d8b25ae1ac
8 changed files with 433 additions and 79 deletions

View File

@@ -16,8 +16,11 @@ typedef struct {
i2c_port_num_t i2c_port;
gpio_num_t scl_io_num;
gpio_num_t sda_io_num;
uint16_t read_period_ms;
uint8_t bh1750_addr;
bool i2c_enable_internal_pullup;
bool bh1750_enable;
bool aht30_enable;
uint16_t bh1750_read_period_ms;
uint16_t aht30_read_period_ms;
bh1750_measure_mode_t bh1750_mode;
} i2c_master_messager_config_t;
@@ -28,8 +31,17 @@ typedef struct {
esp_err_t last_error;
} i2c_bh1750_data_t;
typedef struct {
float temperature_c;
float humidity_rh;
bool valid;
int64_t last_update_ms;
esp_err_t last_error;
} i2c_aht30_data_t;
typedef struct {
i2c_bh1750_data_t bh1750;
i2c_aht30_data_t aht30;
} i2c_master_messager_data_t;
#define I2C_MASTER_MESSAGER_MIN_PERIOD_MS (100)