I appreciate there is another thread which had a similar topic but no solution and is quite old.
I am running on 0.8.0-RC.11 with wifi setup using softAP - the code is pretty much as per the example provided in the documentation [html headers, background colour and pop-up window text has been changed].
I am finding that occasionally the wifi setup process starts but hangs/halts the application loop after WiFi.listen(); is called. I have a user interface and the setup process is initiated from a screen with a timeout progress bar updated every second. I have suspected that low memory / heap is the cause of this hanging but only from reading of certain threads. Sometimes the application progress freezes but the setup web page is visible and can be used to enter and store credentials.
The question I have is this - how can I find out what is causing the observed behaviour my application and if it is low memory, is there a safe level that I can set and check for before allowing the user to initiate the setup process?
Additionally, would using retained RAM a way to make some more space to increase the chance the setup will work correctly?
@armor, thanks for reporting this issue. Could you provide a minimal example code that demonstrates the problem? I don’t see
WiFi.listen() being called in the example app.
@Sergey I have a workaround now for this issue in that I check for System.freeMemory() before allowing the user to enter into the wifi setup process. I have been able to set the level such that I can repeat the wifi setup process at least 4 times which allows for someone making a mistake. I have made more more free memory by utilising retained RAM.
Below are the highlights of the code.
waps_before = 0;
//connection symbol in listening mode
setupTimeout = 0;
wifi_setup = 0;
WiFi.listen(); //start listening
When this has finished it then loops in this function until successful, timeout on the timer is handled elsewhere and stops listening.
if (millis() - wifi_setup >= 1000)
wifi_setup = millis();
int bar = setupTimeout*100/180;
if (bar > 100) bar = 100;
int waps_now = WiFi.getCredentials(ap, 5);
if ((waps_now > waps_before) || WiFi.connecting())
runState = D_SUCCESSWIFISETUP;