Preperations for dual antenna setups

This commit is contained in:
2021-11-29 20:08:21 +01:00
parent 0667bf195b
commit 70cfbfbb3e
2 changed files with 34 additions and 0 deletions

View File

@@ -335,6 +335,34 @@ void init(const config &config)
ESP_LOGE(TAG, "wifi_set_ap_config() failed with %s", esp_err_to_name(result));
}
if (config.dual_ant)
{
{
constexpr const wifi_ant_gpio_config_t config {
.gpio_cfg {
wifi_ant_gpio_t { .gpio_select = 1, .gpio_num = 2 },
wifi_ant_gpio_t { .gpio_select = 1, .gpio_num = 25 }
}
};
if (const auto result = esp_wifi_set_ant_gpio(&config); result != ESP_OK)
ESP_LOGE(TAG, "esp_wifi_set_ant_gpio() failed with %s", esp_err_to_name(result));
}
{
wifi_ant_config_t config {
.rx_ant_mode = WIFI_ANT_MODE_AUTO,
.rx_ant_default = WIFI_ANT_ANT0,
.tx_ant_mode = WIFI_ANT_MODE_AUTO,
.enabled_ant0 = 0b0001,
.enabled_ant1 = 0b0010
};
if (const auto result = esp_wifi_set_ant(&config); result != ESP_OK)
ESP_LOGE(TAG, "esp_wifi_set_ant() failed with %s", esp_err_to_name(result));
}
}
last_ap_config = config.ap;
_wifiState = WiFiState::None;

View File

@@ -131,6 +131,11 @@ struct sta_scan_config
}
};
struct dual_ant_config
{
};
struct sta_config
{
std::string hostname;
@@ -211,6 +216,7 @@ struct eth_config
struct config
{
std::optional<mac_t> base_mac_override;
std::optional<dual_ant_config> dual_ant;
std::optional<sta_config> sta;
std::optional<ap_config> ap;
#ifdef CONFIG_ETH_ENABLED