-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix ESP8266 driver behavior on connection failures #10377
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
Fix ESP8266 driver behavior on connection failures #10377
Conversation
@michalpasztamobica, thank you for your changes. |
23267c8
to
0221ef4
Compare
@kjbracey-arm , @SeppoTakalo , would you please provide any review remarks? |
I had a talk with Kevin and my understanding is that giving up after 30 seconds in blocking mode should be fine. The rest of this comment you should read as my opinion. Assumption here is that each connection attempt takes at maximum ~15 seconds(ESP8266_CONNECT_TIMEOUT). There is a 15 second grace period between the attempts with the current implementation. In other words please increase ESP8266_INTERFACE_CONNECT_TIMEOUT_MS to 30s+some seconds so that connect procedure has time to run two times if necessary. That timelimit tells how long the driver has time to initiate a new connect-call, not when it should be done. It might still take 15 seconds(ESP8266_CONNECT_TIMEOUT) before the procedure succeeds or fails. So altogether it might take ~45 seconds that we know has the connection been established or did it fail. I guess the grace period could be tuned down a bit from that 15 seconds so that the documentation can say we give up after 45 seconds. Return value should be something which makes possible to break out from the loop in blocking-mode. |
0221ef4
to
d4adad6
Compare
@VeijoPesonen , thank you for this valuable comment. I fully agree with your opinion, I tried to embrace it in the code with the following line:
I hope this would make it cristal clear for anyone reading the code in the future what this timeout depends on and what to consider when adjusting it. |
d4adad6
to
453e485
Compare
0386089
to
7472b19
Compare
The ESP chip returns timeout, but keeps trying to connect, so we want to keep track of time ourselves, instead of relying on the chip's timeout. This fixes failing WIFI-CONNECT-SECURE-FAIL test.
7472b19
to
3e70df7
Compare
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Description
In case the application calls
disconnect()
the driver will only perform actual disconnection procedure (including a status update and event signalling) if the ESP was really disconnected. This was added in this commit, but in fact user might calldisconnect()
for example after a failed connection attempt. In this case we should stop trying to connect, so that a retry is possible. This is also how EMAC drivers work.Furthermore, we did not make use of ESP8266 timeout message, because in fact it kept on trying to connect. Therefore we need to use our own timeout to return a proper error value if the connection really takes too long.
Pull request type
Reviewers
@VeijoPesonen
@SeppoTakalo