I've been having problems with rESP8266WiFi so have done some testing as follows. The timeout periods seem to be excessive and there is an error message on retry. I can't find any way to reduce the timeout or to avoid the error message.
Test Code (modified 'blank' esp code):
Results:
Sync
----
SSID and Password correct: connection between 600 and 1500 mS
SSID incorrect: failed at about 15000 mS
Password incorrect: failed at 75000 mS, i.e. 75 seconds!
Both incorrect: failed at about 15000 mS
15 seconds/ 75 seconds seem unnecessarily long!
Ansync
------
SSID and Password correct: connection at about 150 mS
SSID incorrect: failed at about 2500 mS
Password incorrect: failed at between 450000 mS and 900000 mS, i.e. up to 15 minutes!!
Both incorrect: failed at about 2500 mS
7.5/ 15minutes is just unbelievable !
Error message on each retry: "E (107629) wifi:sta is connecting, return error" , the number increases by 25000 (i.e. must be a 'millis' value, 25 Seconds, 15 S to fail + 10 S waiting for retry) each time:
Any suggestions? Am I doing something wrong?
Test Code (modified 'blank' esp code):
Test code:
Sub Process_Globals
Public Serial1 As Serial
Private wifi As ESP8266WiFi
Dim ConnectStart As ULong
Dim count As Int
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
'example of connecting to a local network
connectloop(0)
End Sub
Sub connectloop(loopcount As Byte)
'non-blocking delay - doesn't seem to help with error message
If loopcount > 4 Then Return
Log("Connect: ", loopcount)
Connect
CallSubPlus("connectloop", 10000, loopcount + 1)
End Sub
Sub Connect
ConnectStart = Millis
' wifi.ConnectAsync("SSID", "Password", 0, Null, "wifi_Connected")
If wifi.Connect2("SSID", "Password") Then
Log("Connected to network after ", (Millis - ConnectStart), " Millis")
Else
Log("Failed to connect to network after", (Millis - ConnectStart), " Millis")
'wifi.Disconnect 'doesn't make any difference
End If
End Sub
Sub wifi_Connected(Success As Boolean)
If Success Then
Log("Async success after ", (Millis - ConnectStart), " Millis")
Else
Log("Async failed after ", (Millis - ConnectStart), " Millis")
End If
End Sub
Results:
Sync
----
SSID and Password correct: connection between 600 and 1500 mS
SSID incorrect: failed at about 15000 mS
Password incorrect: failed at 75000 mS, i.e. 75 seconds!
Both incorrect: failed at about 15000 mS
15 seconds/ 75 seconds seem unnecessarily long!
Ansync
------
SSID and Password correct: connection at about 150 mS
SSID incorrect: failed at about 2500 mS
Password incorrect: failed at between 450000 mS and 900000 mS, i.e. up to 15 minutes!!
Both incorrect: failed at about 2500 mS
7.5/ 15minutes is just unbelievable !
Error message on each retry: "E (107629) wifi:sta is connecting, return error" , the number increases by 25000 (i.e. must be a 'millis' value, 25 Seconds, 15 S to fail + 10 S waiting for retry) each time:
Logs:
AppStart
Connect: 0
Failed to connect to network after15098 Millis
Connect: 1
E (32611) wifi:sta is connecting, return error
Failed to connect to network after15001 Millis
Connect: 2
E (57617) wifi:sta is connecting, return error
Failed to connect to network after15001 Millis
Connect: 3
E (82623) wifi:sta is connecting, return error
Failed to connect to network after15001 Millis
Connect: 4
E (107629) wifi:sta is connecting, return error
Failed to connect to network after15001 Millis
Any suggestions? Am I doing something wrong?