- 增加了 `ui.h` 中资源数组的大小以容纳新的 UI 元素。 - 更新了 `ui_font_chinese_16.c`,添加了更多中文字符以更好地支持本地化。 - 在 `vars.h` 中添加了用于管理火焰状态的新函数,增强了系统的监测能力。
44 lines
772 B
C
44 lines
772 B
C
#pragma once
|
||
|
||
#include <stdbool.h>
|
||
#include <stdint.h>
|
||
|
||
#include "esp_err.h"
|
||
#include "esp_adc/adc_oneshot.h"
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
// ESP32-S3: GPIO8 -> ADC1_CHANNEL_7
|
||
#define MQ2_ADC_GPIO 8
|
||
|
||
/**
|
||
* @brief 初始化 MQ-2 ADC 通道
|
||
*/
|
||
esp_err_t mq2_init(void);
|
||
|
||
/**
|
||
* @brief 读取 MQ-2 原始 ADC 值(0~4095)
|
||
*/
|
||
esp_err_t mq2_read_raw(int *raw_out);
|
||
|
||
/**
|
||
* @brief 读取 MQ-2 归一化百分比(0~100)
|
||
*/
|
||
esp_err_t mq2_read_percent(float *percent_out);
|
||
|
||
/**
|
||
* @brief 根据阈值判断是否疑似有害气体/烟雾超标
|
||
*/
|
||
bool mq2_is_alarm(float percent, float threshold_percent);
|
||
|
||
/**
|
||
* @brief 获取 MQ-2 使用的 ADC oneshot 句柄(ADC1)
|
||
*/
|
||
adc_oneshot_unit_handle_t mq2_get_adc_handle(void);
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|