Page 1 of 1

Timeout with improper wifi credentials

Posted: Fri Aug 25, 2017 6:31 pm
by kuitthegeek
Hello all,
I have run into a very interesting issue that I need to resolve. I am still trying to come up to speed on the ESP32 API and FreeRTOS, so my apologies, and please bare with me. I am trying to set up the some functionality using the blufi example, and I have found an issue that I am still trying to dig out and resolve. What I have currently set up is a project with the blufi example as a header file, and my own custom main.c to run everything. I have it set up so that I can call blufi and run it if I need to, as I don't want it to be advertising if it has a valid wifi connection. So on boot, it will try to connect to wifi, and if it can't the it will start blufi so I can retrieve wifi credentials.
The problem is, if I pass in the wrong wifi credentials, then the ESP32 will get stuck trying to connect to wifi. It will loop, trying to init->auth, auth->assoc, assoc->run, but it won't connect (because if has bad wifi config info), and it won't timeout because it can't connect. So I have to wipe the flash, or reprogram with blufi not being disabled on boot to pass in new credentials. This is fine for me, but I need to have this so that if someone else were using it, and on initial setup they put in the wrong info accidentally, there would be an option to allow them to reconnect and try again.
So the wifi authentication keeps looping when it has the wrong credentials not the correct information. I can't seem to figure out what is causing it, but I think it is the esp_wifi_connect() function and it doesn't time out. I can add the code to make it time out, but when I check if the return status of esp_wifi_connect(), even with bad info it returns ESP_OK.
I would appreciate any and all help to understanding how to fix this bug.
-Kuit

Re: Timeout with improper wifi credentials

Posted: Mon Sep 18, 2017 2:43 am
by liuzhifu
Thanks @kuitthegeek, we will consider your propose. Maybe will do some optimization for it in 3.0 to make application programming easier.

Re: Timeout with improper wifi credentials

Posted: Tue Oct 10, 2017 10:39 am
by liuzhifu
HI @kuitthegeek could you let me know your WiFi event handling function and WiFi init code?