allow configuring different dual ant pins

This commit is contained in:
2022-03-30 14:48:42 +02:00
parent 8d69883a41
commit 0c949def03
2 changed files with 7 additions and 5 deletions

View File

@@ -343,14 +343,14 @@ void init(const config &config)
if (config.dual_ant) if (config.dual_ant)
{ {
{ {
constexpr const wifi_ant_gpio_config_t config { const wifi_ant_gpio_config_t cfg {
.gpio_cfg { .gpio_cfg {
wifi_ant_gpio_t { .gpio_select = 1, .gpio_num = 2 }, wifi_ant_gpio_t { .gpio_select = 1, .gpio_num = (uint8_t)config.dual_ant->selectPin0 },
wifi_ant_gpio_t { .gpio_select = 1, .gpio_num = 25 } wifi_ant_gpio_t { .gpio_select = 1, .gpio_num = (uint8_t)config.dual_ant->selectPin1 }
} }
}; };
if (const auto result = esp_wifi_set_ant_gpio(&config); result != ESP_OK) if (const auto result = esp_wifi_set_ant_gpio(&cfg); result != ESP_OK)
ESP_LOGE(TAG, "esp_wifi_set_ant_gpio() failed with %s", esp_err_to_name(result)); ESP_LOGE(TAG, "esp_wifi_set_ant_gpio() failed with %s", esp_err_to_name(result));
} }

View File

@@ -11,6 +11,7 @@
// esp-idf includes // esp-idf includes
#include <esp_wifi_types.h> #include <esp_wifi_types.h>
#include <hal/gpio_types.h>
// 3rdparty lib includes // 3rdparty lib includes
#include <espchrono.h> #include <espchrono.h>
@@ -133,7 +134,8 @@ struct sta_scan_config
struct dual_ant_config struct dual_ant_config
{ {
gpio_num_t selectPin0{GPIO_NUM_2};
gpio_num_t selectPin1{GPIO_NUM_25};
}; };
struct sta_config struct sta_config