Time to connect to Wi-Fi

I’m extending my imp code to manage manual connection to wi-fi networks, i.e. scanning for available networks and reconnecting when I have appropriate stored credentials.
Using server.connectwith, it seems to take a long time for the imp to connect (and a very long time to fail to connect if the password is wrong). Is this as expected?

2024-01-31T14:36:59 [INFO][ConnectionManager] Connecting to Wi-Fi network ‘xxxxx’
2024-01-31T14:37:56 [INFO][ConnectionManager] Server connection result The server is connected(5)


Which imp type are you using? Are you passing the timeout parameter?

Is the time taken to connect/fail very different than using server.connect() for the first time after a blinkup or calling imp.setwificonfiguration()?

If you are passing a plaintext password into server.connectwith() each time, then impOS needs to scan for the encryption type before attempting to join a network. You should see faster re-connection if you save the table returned by imp.net.getcurrentconfig() and pass that into subsequent server.connectwith() calls.

Hi Phil,
I’m working on an imp006 breakout (with wifi and cellular enabled) and using a timeout value of 60s in all connect calls.
If I use an invalid password I’m seeing this kind of delay before I get a callback:

2024-01-31T16:07:20 [INFO][ConnectionManager] Connecting to Wi-Fi network 'xxxxx'
2024-01-31T16:09:15 [INFO][ConnectionManager] Server connection result Failed to join WiFi(1)

For successful connections I’ll take a look at using imp.net.getcurrentconfig rather than the raw details I’m currently saving.

This topic was automatically closed after 60 days. New replies are no longer allowed.