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:
@@ -14,8 +14,6 @@ idf_component_register(SRCS
|
||||
"ui/widgets/ui_comp_hook.c"
|
||||
PRIV_REQUIRES
|
||||
bt
|
||||
esp_wifi
|
||||
esp_netif
|
||||
nvs_flash
|
||||
esp_driver_ledc
|
||||
esp_driver_spi
|
||||
|
||||
+6
-1
@@ -7,9 +7,12 @@
|
||||
#include "touch.h"
|
||||
#include "ui.h"
|
||||
#include "ui_handlers.h"
|
||||
#include "wifi_manager.h"
|
||||
#include "ble_manager.h"
|
||||
|
||||
#if BOARD_WIFI_ENABLED
|
||||
#include "wifi_manager.h"
|
||||
#endif
|
||||
|
||||
static const char *TAG = "app";
|
||||
|
||||
void app_main(void)
|
||||
@@ -39,8 +42,10 @@ void app_main(void)
|
||||
|
||||
ui_handlers_init();
|
||||
|
||||
#if BOARD_WIFI_ENABLED
|
||||
ESP_LOGI(TAG, "Starting WiFi");
|
||||
wifi_manager_init();
|
||||
#endif
|
||||
|
||||
ESP_LOGI(TAG, "Starting BLE");
|
||||
ble_manager_init();
|
||||
|
||||
@@ -48,6 +48,9 @@
|
||||
/* BLE (ESP32-S3 built-in radio) */
|
||||
#define BOARD_BLE_ENABLED 1
|
||||
|
||||
/* WiFi */
|
||||
#define BOARD_WIFI_ENABLED 0
|
||||
|
||||
/* LVGL port */
|
||||
#define BOARD_LVGL_DRAW_BUF_LINES 20
|
||||
#define BOARD_LVGL_TICK_PERIOD_MS 2
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
#include "wifi_manager.h"
|
||||
|
||||
#include "board_config.h"
|
||||
|
||||
#if BOARD_WIFI_ENABLED
|
||||
|
||||
#include "esp_event.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_netif.h"
|
||||
@@ -114,3 +118,14 @@ void wifi_manager_init(void)
|
||||
|
||||
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 */
|
||||
|
||||
Reference in New Issue
Block a user