feat: 添加编译时模块开关配置
通过 sdkconfig.defaults 选择性启用/禁用模块,减少固件体积: 新增模块开关: - CONFIG_MIMI_CHAN_TELEGRAM (默认 n) - CONFIG_MIMI_CHAN_FEISHU (默认 y) - CONFIG_MIMI_TOOL_WEB_SEARCH (默认 y) - CONFIG_MIMI_TOOL_GPIO (默认 n) - CONFIG_MIMI_WS_SERVER (默认 y) - CONFIG_MIMI_WIFI_ONBOARD (默认 y) - CONFIG_MIMI_OTA (默认 n) 技术实现: - CMakeLists.txt 条件编译源文件 - 头文件使用 static inline stub - CLI 命令和工具注册也支持条件编译 消除 Telegram 未配置时的 5 秒轮询警告日志
This commit is contained in:
@@ -2,26 +2,20 @@
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
/**
|
||||
* Initialize the Telegram bot.
|
||||
*/
|
||||
#ifdef CONFIG_MIMI_CHAN_TELEGRAM
|
||||
esp_err_t telegram_bot_init(void);
|
||||
|
||||
/**
|
||||
* Start the Telegram polling task (long polling on Core 0).
|
||||
*/
|
||||
esp_err_t telegram_bot_start(void);
|
||||
|
||||
/**
|
||||
* Send a text message to a Telegram chat.
|
||||
* Automatically splits messages longer than 4096 chars.
|
||||
* @param chat_id Telegram chat ID (numeric string)
|
||||
* @param text Message text (supports Markdown)
|
||||
*/
|
||||
esp_err_t telegram_send_message(const char *chat_id, const char *text);
|
||||
|
||||
/**
|
||||
* Save the Telegram bot token to NVS.
|
||||
*/
|
||||
esp_err_t telegram_set_token(const char *token);
|
||||
|
||||
#else
|
||||
static inline esp_err_t telegram_bot_init(void) { return ESP_OK; }
|
||||
static inline esp_err_t telegram_bot_start(void) { return ESP_OK; }
|
||||
static inline esp_err_t telegram_send_message(const char *chat_id, const char *text) {
|
||||
(void)chat_id; (void)text;
|
||||
return ESP_OK;
|
||||
}
|
||||
static inline esp_err_t telegram_set_token(const char *token) {
|
||||
(void)token;
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user