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:
2026-04-03 20:15:26 +08:00
parent 540bfe825f
commit 6983a1f1ba
15 changed files with 455 additions and 154 deletions

View File

@@ -2,24 +2,15 @@
#include "esp_err.h"
/**
* Initialize and start the WebSocket server on MIMI_WS_PORT.
* Allows external clients to interact with the Agent via JSON messages.
*
* Protocol:
* Inbound: {"type":"message","content":"hello","chat_id":"ws_client1"}
* Outbound: {"type":"response","content":"Hi!","chat_id":"ws_client1"}
*/
#ifdef CONFIG_MIMI_WS_SERVER
esp_err_t ws_server_start(void);
/**
* Send a text message to a specific WebSocket client by chat_id.
* @param chat_id Client identifier (assigned on connection)
* @param text Message text
*/
esp_err_t ws_server_send(const char *chat_id, const char *text);
/**
* Stop the WebSocket server.
*/
esp_err_t ws_server_stop(void);
#else
static inline esp_err_t ws_server_start(void) { return ESP_OK; }
static inline esp_err_t ws_server_send(const char *chat_id, const char *text) {
(void)chat_id; (void)text;
return ESP_OK;
}
static inline esp_err_t ws_server_stop(void) { return ESP_OK; }
#endif