diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index a86b1e8..4418178 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -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 diff --git a/main/app/app_main.c b/main/app/app_main.c index 87b2d51..a02eb38 100644 --- a/main/app/app_main.c +++ b/main/app/app_main.c @@ -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(); diff --git a/main/bsp/board_config.h b/main/bsp/board_config.h index f28ca66..b738e5e 100644 --- a/main/bsp/board_config.h +++ b/main/bsp/board_config.h @@ -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 diff --git a/main/services/wifi_manager.c b/main/services/wifi_manager.c index 26c6337..a20ccc2 100644 --- a/main/services/wifi_manager.c +++ b/main/services/wifi_manager.c @@ -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 */ diff --git a/sdkconfig.defaults b/sdkconfig.defaults index c4a1e49..c90c0d2 100644 --- a/sdkconfig.defaults +++ b/sdkconfig.defaults @@ -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 -# 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_LARGE=y -# BLE (NimBLE peripheral, coexists with WiFi) +# BLE (NimBLE peripheral) CONFIG_BT_ENABLED=y CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT=n