diff --git a/src/espwifistack.cpp b/src/espwifistack.cpp index bc1ca12..765c9ba 100644 --- a/src/espwifistack.cpp +++ b/src/espwifistack.cpp @@ -2055,6 +2055,10 @@ esp_err_t wifi_sync_mode(const config &config) if (const auto result = esp_wifi_set_protocol(WIFI_IF_AP, WIFI_PROTOCOL_LR); result != ESP_OK) ESP_LOGE(TAG, "esp_wifi_set_protocol() for AP long range failed with %s", esp_err_to_name(result)); + if (config.country) + if (const auto result = esp_wifi_set_country(&*config.country); result != ESP_OK) + ESP_LOGE(TAG, "esp_wifi_set_country_code() failed with %s", esp_err_to_name(result)); + if (const auto result = wifi_start(); result != ESP_OK) { ESP_LOGE(TAG, "wifi_start() failed with %s", esp_err_to_name(result)); diff --git a/src/espwifistackconfig.h b/src/espwifistackconfig.h index 76fc495..348aab7 100644 --- a/src/espwifistackconfig.h +++ b/src/espwifistackconfig.h @@ -216,6 +216,7 @@ struct config #ifdef CONFIG_ETH_ENABLED std::optional eth; #endif + std::optional country; friend bool operator==(const config &left, const config &right) {