Unresponsive with no blinking for 10 seconds on wake

I’ve been struggling with this issue for too many hours at this point and finally have a good summary of what’s happening:
IF I provide a bad SSID (fake network) to the imp and allow it to go to sleep, when i reawaken it with a button press it does (almost) no blinking and is unresponsive to button presses (including power off). By almost no blinking I mean it blinks amber for a millisecond and then after 10 seconds I see another extremely short blink, THEN it runs my code. I have set my timeout policy how I want, first two lines of my code are:

const TIMEOUT_SERVER_S = 20; // timeout for wifi connect and send server.setsendtimeoutpolicy(RETURN_ON_ERROR, WAIT_TIL_SENT, TIMEOUT_SERVER_S);
so I know it’s not an issue with that.

and the first real code that runs is to configure an LED and then turn it on so I know the exact time that my code begins to run (offline debugging is a pain). Just to be clear: I am NOT trying to connect to the server first, I am switching on an LED before ANY OTHER CODE except my constatnts that I set at the top.

If it has a good SSID it seems to work fine, I press the button and it begins running code immediately.

So my question is this:
Is it my code? I find that hard to believe since it takes 10 seconds to get to the first line. Is this something built into the imp? If it is, is there a way to disable it?

First few lines of code:

function main() { hardware.pin5.configure(PWM_OUT, 1.0/400.0, 0.0); hardware.pin5.write(1.0); imp.enableblinkup(true); blueLed.on(); <---takes 10 seconds to get to here imp.sleep(15); blueLed.off(); imp.enableblinkup(false);

Any help is greatly appreciated!

Also I’m not working with a breakout board and have no UART access so far.

First, I’m not sure why you have the imp.enableblinkup() calls in there, especially since it’s only enabled for 15 seconds or so. imp.sleep() blocks the processor, so enabling BlinkUp at this point seems even more unnecessary.

Second, you mention waking with a button press - is this effectively powering the imp on? If so, the imp will cold boot and attempt to connect. This will fail (the SSID is fake) and lead to your Squirrel running 10 seconds from start. This is expected behaviour.

See the WiFi State Diagram: your imp is going Cold Start -> Boot -> Have Squirrel -> Active Offline.

When Squirrel runs (after 10s), that’s when the policy is set.

This is a known issue in release 30.22, and is fixed in the next release. A new blinkup with bad credentials would cause this. If you would like to test the fix, let us know a mac address and we’ll push it to your device.