We have developed one code to scan all list of Wi-Fi Access points and trying to connect specific Access points based on RSSI.
It was working fine till few days and able to connect successfully in case of device disconnected.
But, Suddenly, we are getting esp_wifi_scan_get_ap_num as 0 count and not able to scan any AP list.
esp_wifi_scan_start success
Scan count 0
Stop scan success
Code: Select all
err = esp_wifi_scan_start(NULL, true);
if(err != ESP_OK)
{
ESP_LOGE(TAG, "esp_wifi_scan_start: fail");
break;
} else {
ESP_LOGI(TAG, "esp_wifi_scan_start: success");
uint16_t number = SCAN_DEFUALT_LIST_SIZE;
wifi_ap_record_t ap_info[SCAN_DEFUALT_LIST_SIZE];
uint16_t ap_count = 0;
memset(ap_info, 0, sizeof(ap_info));
err = esp_wifi_scan_get_ap_records(&number, ap_info);
if(err != ESP_OK)
{
ESP_LOGE(TAG, "esp_wifi_scan_get_ap_records: fail");
}
err = esp_wifi_scan_get_ap_num(&ap_count);
ESP_LOGE(TAG, "Scan count %d", ap_count);
Can it be due to memory issue or any other issue?
ESP32 IDF Version - 5.1 we are using.
Let me know if need anything else from my end regarding this issue