Hi All,
I have been trying to setup APSTA mode without success , can anyone spot a problem. I am bit confused by this API - what should I set
esp_wifi_set_config(WIFI_IF_AP, &wifi_config) to in this case as there is no option for APSTA mode.
#define AP_EXAMPLE_WIFI_SSID "IMTIAZ\0"
#define AP_EXAMPLE_WIFI_PASS "12345678"
#define STA_EXAMPLE_WIFI_SSID "Syrp_Wireless"
#define STA_EXAMPLE_WIFI_PASS "87654321"
static void initialise_wifi(void)
{
tcpip_adapter_init();
wifi_event_group = xEventGroupCreate();
ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) );
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
wifi_config_t wifi_config = {
.sta ={
.ssid = STA_EXAMPLE_WIFI_SSID,
.password = STA_EXAMPLE_WIFI_PASS,
},
.ap = {
.ssid = AP_EXAMPLE_WIFI_SSID,
.ssid_len = 0,
.password = AP_EXAMPLE_WIFI_PASS,
.channel = 1,
.authmode = WIFI_AUTH_WPA2_PSK,
.beacon_interval = 400,
.max_connection = 16,
}
};
ESP_LOGI(TAG, "Setting WiFi AP: SSID %s", wifi_config.ap.ssid);
ESP_LOGI(TAG, " Pass %s", wifi_config.ap.password);
ESP_LOGI(TAG, "Setting WiFi STA: SSID %s", wifi_config.sta.ssid);
ESP_LOGI(TAG, " Pass %s", wifi_config.sta.password);
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_APSTA) );
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_AP, &wifi_config) );
//ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
ESP_ERROR_CHECK( esp_wifi_start());
}