-
Notifications
You must be signed in to change notification settings - Fork 186
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
handleRequest() use DHCP for reconnect to STA #400
Comments
@DanielSamp4 Sorry for the late reply and thank you for the appropriate advice on AutoConnect's reconnect feature. To grasp the meaning of your advice, I started by tracing the source code. And I realized that the phenomenon you encountered might occur under the following process sequence:
Apparently, the problem is with refreshing the _apConfig it will matche the fix you offered. If my trace is correct, the conditions for reproducing the problem are as follows:
Does the above conditions for reproduction match the scene in which you encountered the problem? Thank you for your contribution. P.S. |
@DanielSamp4 I have scrutinized your proposed amendment further. As a result, I have unfortunately come to the conclusion that your modification will induce a different dysfunction. Let’s suppose that you still have established a connection with any access point, you entered a new connection setting with Configure new AP menu. AutoConnect::_induceConnect will receive the APPLY request and will retrieve the static IP settings contained in the POST request. The retrieved configuration settings (which are the values you entered using Configure new AP menu) are passed to _apConfig and become parameters for _configSTA on the next handleRequest turn. AutoConnect/src/AutoConnect.cpp Lines 1318 to 1335 in 1089d73
So your fix will overwrite the static IP settings that the user entered using Configure new AP menu. |
@DanielSamp4 I committed the fix. Please evaluate a fix with the enhance/v131 branch. |
Sometimes when my ESP32 stay up for long period, i got 4WAY_HANDSHAKE_TIMEOUT and got STA_DISCONNECTED, but fine we all know that disconnects from a Wifi network its pretty common, so i configure the AutoConnectConfig.reconnectInterval so that my ESP may reconnect to the network and work perfctly.
But i notice that if i have setted a Static IP Address and lose Wifi conection when the ESP reconnect the IP Address assigned was not what i chose anymore, as if DHCP config was enable.
Nonetheless when i restart the ESP, the IP Address that i have assigned was restored, so i realize that the problem have to be on handleRequest() function. because when i start the ESP i use Begin method to configure the connection, but when i'm in the loop section handleRequest() that handle the connection issues.
So i dive into handleRequest() and Begin() method to see if i can recoginize the diferences between the two.
in Begin method i can see that you firstly restore the current STA configuration for them configure the STA, as the blue arrows show:
But in handleRequest there is no restoration of STA consfiguration
So i add this remember part into the handleRequest method
![fig3](https://user-images.githubusercontent.com/56495082/133350280-e44b439e-a237-44ef-a176-53ff38789deb.PNG)
and work like i wanted, when my ESP get disconnected from the wifi and i have been setted with static IP addres, reconnect with the same IP address i have been assigned.
So, i'd like to know if my alteration can causely some strange behavior in the library in general, since my project uses your library a lot, or if that is a simple way to resolve this. Thanks!!
Sorry for my english, its not my first language.
The text was updated successfully, but these errors were encountered: