feat: 更新 WiFi 管理与配置

- 在 sdkconfig.defaults 中禁用 WiFi 支持
- 更新 app_main.c 以根据配置条件编译 WiFi 管理器
- 修改 CMakeLists.txt,移除 WiFi 相关依赖
- 在 wifi_manager.c 中添加条件编译以处理 WiFi 禁用情况
- 更新 board_config.h,定义 WiFi 启用标志
This commit is contained in:
2026-07-01 22:48:13 +08:00
parent 6c348c600c
commit b6a871a3b9
5 changed files with 27 additions and 6 deletions
-2
View File
@@ -14,8 +14,6 @@ idf_component_register(SRCS
"ui/widgets/ui_comp_hook.c" "ui/widgets/ui_comp_hook.c"
PRIV_REQUIRES PRIV_REQUIRES
bt bt
esp_wifi
esp_netif
nvs_flash nvs_flash
esp_driver_ledc esp_driver_ledc
esp_driver_spi esp_driver_spi
+6 -1
View File
@@ -7,9 +7,12 @@
#include "touch.h" #include "touch.h"
#include "ui.h" #include "ui.h"
#include "ui_handlers.h" #include "ui_handlers.h"
#include "wifi_manager.h"
#include "ble_manager.h" #include "ble_manager.h"
#if BOARD_WIFI_ENABLED
#include "wifi_manager.h"
#endif
static const char *TAG = "app"; static const char *TAG = "app";
void app_main(void) void app_main(void)
@@ -39,8 +42,10 @@ void app_main(void)
ui_handlers_init(); ui_handlers_init();
#if BOARD_WIFI_ENABLED
ESP_LOGI(TAG, "Starting WiFi"); ESP_LOGI(TAG, "Starting WiFi");
wifi_manager_init(); wifi_manager_init();
#endif
ESP_LOGI(TAG, "Starting BLE"); ESP_LOGI(TAG, "Starting BLE");
ble_manager_init(); ble_manager_init();
+3
View File
@@ -48,6 +48,9 @@
/* BLE (ESP32-S3 built-in radio) */ /* BLE (ESP32-S3 built-in radio) */
#define BOARD_BLE_ENABLED 1 #define BOARD_BLE_ENABLED 1
/* WiFi */
#define BOARD_WIFI_ENABLED 0
/* LVGL port */ /* LVGL port */
#define BOARD_LVGL_DRAW_BUF_LINES 20 #define BOARD_LVGL_DRAW_BUF_LINES 20
#define BOARD_LVGL_TICK_PERIOD_MS 2 #define BOARD_LVGL_TICK_PERIOD_MS 2
+15
View File
@@ -1,5 +1,9 @@
#include "wifi_manager.h" #include "wifi_manager.h"
#include "board_config.h"
#if BOARD_WIFI_ENABLED
#include "esp_event.h" #include "esp_event.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_netif.h" #include "esp_netif.h"
@@ -114,3 +118,14 @@ void wifi_manager_init(void)
ESP_LOGI(TAG, "WiFi STA started, connecting in background..."); ESP_LOGI(TAG, "WiFi STA started, connecting in background...");
} }
#else
#include "esp_log.h"
void wifi_manager_init(void)
{
ESP_LOGI("wifi_manager", "WiFi disabled by board config");
}
#endif /* BOARD_WIFI_ENABLED */
+3 -3
View File
@@ -1,11 +1,11 @@
CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n # CONFIG_ESP_WIFI_ENABLED is not set
CONFIG_ESP_LCD_TOUCH_CST816S_DISABLE_READ_ID=y CONFIG_ESP_LCD_TOUCH_CST816S_DISABLE_READ_ID=y
# App partition: BLE + WiFi + LVGL exceed default 1MB # App partition: BLE + LVGL exceed default 1MB
CONFIG_PARTITION_TABLE_SINGLE_APP=n CONFIG_PARTITION_TABLE_SINGLE_APP=n
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y
# BLE (NimBLE peripheral, coexists with WiFi) # BLE (NimBLE peripheral)
CONFIG_BT_ENABLED=y CONFIG_BT_ENABLED=y
CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_ENABLED=y
CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT=n CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT=n