From 63628ce68d85c2d62796bfafca33a3fe27f8c2a8 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Fri, 6 May 2022 18:36:44 +0200 Subject: [PATCH] Make dual ant a sdkconfig setting --- CMakeLists.txt | 1 - Kconfig.projbuild | 4 ++++ src/espwifistack.cpp | 2 ++ src/espwifistackconfig.h | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f49498..a303aea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,6 @@ set(sources ) set(dependencies - arduino-esp32 esp_common esp_netif lwip diff --git a/Kconfig.projbuild b/Kconfig.projbuild index 6a877ea..31387a3 100644 --- a/Kconfig.projbuild +++ b/Kconfig.projbuild @@ -36,4 +36,8 @@ config LOG_LOCAL_LEVEL_WIFI_STACK default 4 if LOG_LOCAL_LEVEL_WIFI_STACK_DEBUG default 5 if LOG_LOCAL_LEVEL_WIFI_STACK_VERBOSE +config WIFI_DUAL_ANT + bool "Enable dual antenna functionality" + default false + endmenu diff --git a/src/espwifistack.cpp b/src/espwifistack.cpp index d7506cd..e5fa1a8 100644 --- a/src/espwifistack.cpp +++ b/src/espwifistack.cpp @@ -341,6 +341,7 @@ void init(const config &config) ESP_LOGE(TAG, "wifi_set_ap_config() failed with %s", esp_err_to_name(result)); } +#ifdef CONFIG_WIFI_DUAL_ANT if (config.dual_ant) { { @@ -368,6 +369,7 @@ void init(const config &config) ESP_LOGE(TAG, "esp_wifi_set_ant() failed with %s", esp_err_to_name(result)); } } +#endif last_ap_config = config.ap; diff --git a/src/espwifistackconfig.h b/src/espwifistackconfig.h index 1217541..003a8e3 100644 --- a/src/espwifistackconfig.h +++ b/src/espwifistackconfig.h @@ -132,11 +132,13 @@ struct sta_scan_config } }; +#ifdef CONFIG_WIFI_DUAL_ANT struct dual_ant_config { gpio_num_t selectPin0{GPIO_NUM_2}; gpio_num_t selectPin1{GPIO_NUM_25}; }; +#endif struct sta_config { @@ -236,7 +238,9 @@ struct eth_config struct config { std::optional base_mac_override; +#ifdef CONFIG_WIFI_DUAL_ANT std::optional dual_ant; +#endif std::optional sta; std::optional ap; #ifdef CONFIG_ETH_ENABLED