I have a question about "wifi: Haven't to connect to a suitable AP now"

zhejfl
Posts: 1
Joined: Fri Dec 14, 2018 9:05 am

I have a question about "wifi: Haven't to connect to a suitable AP now"

Postby zhejfl » Fri Dec 14, 2018 9:40 am

I call SM_Quit_wifi() to close the wifi task. Then after one minute, I try to init the WIFI resource and task and connect the AP,but the problem occured.
The Debug Info
I (32849) wifi: mode : sta (30:ae:a4:47:27:ac)
[0;32mI (32849) Somnic_WIFICon: received wifi event 2[0m
[0;32mI (32849) Somnic_WIFICon: connected successfully[0m
W (32849) wifi: Haven't to connect to a suitable AP now!
[0;32mI (32849) WIFICon: current ap ssid:![0m

[0;32mI (122709) event: station ip lost[0m
[0;32mI (122709) WIFICon: received wifi event 8[0m

There are any one know after call esp_wifi_deinit(), how to resolve the problem.

Code: Select all

void SM_Quit_wifi(void)
{
	ESP_ERROR_CHECK(esp_wifi_disconnect());
	if(esp_wifi_stop()==ESP_ERR_WIFI_NOT_INIT)  //停止WIFI
	{
		ESP_LOGE(SM_WFC,"Please Init WIFI, then call this function!\r\n");
		return;
	}
	if(esp_wifi_deinit()==ESP_ERR_WIFI_NOT_INIT) //释放wifi所有资源和WIFI任务
	{
		ESP_LOGE(SM_WFC,"Please Init WIFI, then call this function!\r\n");
	}
}

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: I have a question about "wifi: Haven't to connect to a suitable AP now"

Postby Ritesh » Sun Dec 16, 2018 4:56 pm

Hi,

First of all, is there any requirement or reason to deinit WiFi as you just need to disconnect and stop WiFi if not required.

And then just start it again without WiFi init again.

We have did this way successfully into our project without any issue. So, Just try with below steps

1) WiFi disconnect
2) Stop WiFi
3) Change configuration
4) WiFi Start
5) WiFi connect
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: Bing [Bot] and 164 guests