I want to perform a Wifi scan while the ESP is mesh connected ( and If I found a specific AP tell to the ESP to connect to it ).
I'm trying to do this: https://docs.espressif.com/projects/esp ... -mesh.html
At Calling Wi-Fi API paragraph.
But the ESP "sees" only an AP:
Code: Select all
uint16_t number = 10;
wifi_ap_record_t ap_info[10];
uint16_t ap_count;
memset(ap_info, 0, sizeof(ap_info));
wifi_scan_config_t scan_config = {
.ssid = 0,
.bssid = 0,
.channel = 0,
.show_hidden = true
};
//Disable self organized networking
esp_mesh_set_self_organized(0, 0);
//Stop any scans already in progress
esp_wifi_scan_stop();
//Manually start scan. Will automatically stop when run to completion
ESP_ERROR_CHECK(esp_wifi_scan_start(&scan_config, true));
//Process scan results
ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&number, ap_info));
ESP_ERROR_CHECK(esp_wifi_scan_get_ap_num(&ap_count));
ESP_LOGI(TAG, "Total APs scanned = %u", ap_count);
for (int i = 0; i < 10; i++) {
ESP_LOGI(TAG, "SSID : %s\n", ap_info[i].ssid);
}
//Re-enable self organized networking if still connected
esp_mesh_set_self_organized(1, 0);
//Re-enable self organized networking if non-root and disconnected
esp_mesh_set_self_organized(1, 1);
//Re-enable self organized networking if root and disconnected
esp_mesh_set_self_organized(1, 0); //Don't select new parent
esp_mesh_connect(); //Manually reconnect to router