Recovering from Bad BlinkUp Credentials

For basic wifi blinkup… sending the ssid/password to the imp works great. But i’m trying to figure out what exactly happens if you send a bad password. Does the imp continue to run code as normally?

I have a two pins hooked up to a motor driver and it will make a noise upon powering on for testing.

If the credentials are good that I pass over bluetooth, the imp boots up and plays the sound(continues with normal execution.)

If credentials are bad, such as the wifi password. Then I don’t get my power up noise.

What state does the imp go into if it fails to connect with wifi credentials?
If it is stalled in a timeout, how do I get it to just continue with my code on failed connection to wifi?

Using this would be sufficient?

server.setsendtimeoutpolicy(RETURN_ON_ERROR, WAIT_TIL_SENT, 3600);

If the imp can’t connect at boot, it’ll begin running Squirrel (if it has any, of course) after ten seconds while it continues to wait for a response from the server. Check out the Network State Diagram for details.

The server.setsendtimeoutpolicy() call is only applied when it’s encountered, so it can’t change that ten-second timeout (that’s an impOS thing) — the imp is in SUSPEND_ON_ERROR (the default) until the app changes the policy, which therefore needs to happen before the connection attempt times out. But it will return control to your code if WiFi is lost for some reason while your app is running: see How To Run An imp-enabled Device Offline.

1 Like