-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Locked after configuration #163
Comments
There are a few issues here. First, the timeout feature controls how long the configuration portal will remain open before closing automatically not whether it "will go again into configuration mode if it wasn't able to connect during a certain time" Second, do not use wifiManager.autoConnect . See https://github.com/kentaylor/WiFiManager/#evidence-the-premise-is-wrong-and-the-problems-it-causes for reasons. Try this example https://github.com/kentaylor/WiFiManager/tree/master/examples/ConfigOnSwitch . Third it probably didn't freeze. I found a lot of users thought it was failing when it wasn't. This version https://github.com/kentaylor/WiFiManager/ has a different workflow that tested better in my user tests. |
Thanks for pointing me to these issues. Since I have no switch in order to force it to enter in config mode, I think that it could be possible to start the configuration portal when it has no SSID configured or if it has a configured SSID but the waitForConnectResult() returns as 'not connected', do you agree? Or will it be preferable to do a timed wait on wifi.status()? In a quick look to the waitForConnectResult() method, it wasn't clear to me that the function exits if it can't connect, so it can be preferable to read status periodically and exit after a few retries if it still isn't connected. |
@fmgomes asks "do you agree?" Yes I do. waitForConnectResult() will exit if it can't connect. If you look at https://github.com/kentaylor/WiFiManager/tree/master/examples/ConfigOnSwitch you will see as well as going into configuration mode when a button is pushed it implements the logic you suggest. . |
@kentaylor thanks for your feedback, I tried to call the startConfigPortal(), it worked for the configuration part (network scan, etc.), but unfortunately ended with a crash after saving parameters: *WM: Sent wifi save page Exception (9): ctx: sys
ets Jan 8 2013,rst cause:1, boot mode:(1,7) Any idea why? Fernando |
Interesting. Can you reproduce it or did it just happen once? You got to here https://github.com/kentaylor/WiFiManager/blob/master/WiFiManager.cpp#L311 but didn't get to here https://github.com/kentaylor/WiFiManager/blob/master/WiFiManager.cpp#L314 . It probably failed in the call to EspresifSDK function wifi_get_opmode here Exception (9): as described in Table 4–64. Exception Causes at http://0x04.net/~mwk/doc/xtensa.pdf is "9 LoadStoreAlignmentCause Load or store to an unaligned address" . That makes this seem relevant to esp8266/Arduino/issues/1997 . There are some things I don't understand though:-
|
@kentaylor, thanks again for your reply. I will try in a more conventional node. I'm using an esp12 but with custom hardware to trigger the power down mode by software, so other things might happen and make it more difficult to analyze the results, specially the reset cause and boot mode. I'll try with a conventional nodeMCU, and post here the results. |
Trying another device is good because it occurred to me that non volatile memory can be corrupted when WiFiManager fails. I'm not sure what effect this will have but rebooting or loading a new sketch doesn't fix the corrupted non volatile memory. A few hours ago a fix was added to the Arduino core to avoid the memory corruption. See esp8266/Arduino@f2fb43c . You should add this Arduino code. |
In order to test if the WiFi configuration is working, I call WiFi.disconnect(); and reboot the node. It enters in configuration, using the following code:
Serial.println("WiFi Init...");
wifiManager.setAPCallback(configAPCallback);
wifiManager.setTimeout(180);
if (!wifiManager.autoConnect("xpto")) {
// Connection timeout - go to sleep
Serial.println("WiFi configuration timeout! Shutting down");
delay(5000);
digitalWrite(15, LOW);
}
Serial.println("Connected");
I am able to scan and select the network using a browser, but then it 'freezes' when trying to connect to the selected network. Since I'm using the timeout feature I was expecting that it will go again into configuration mode if it wasn't able to connect during a certain time.
Any idea about this problem? Is there any additional test that I can do that can help?
Fernando
The text was updated successfully, but these errors were encountered: