Particle timeout on connected to trigger listening mode

Old topic but doesn’t seem to be working consistently between builds. We also never got the promised golden example sketches for semi automatic (Request: Particle endorsed Semi Automatic, Thread mode test case .ino), maybe @rickkas7 you have them handy?

I’ve timed an automatic sketch that takes ~3 mins 44 secs to trigger a blue light, then a white glow, blue light then green flashing again. Interestingly, it’s only at that point that it runs the code in the setup block.

So, where do folk put their code to trigger listening mode?

if (waitFor(Particle.connected, 60000)) {
        Serial.println("Particle.connected!");
} else {
        Serial.println("Particle.connected timed out, going to listen mode");
        WiFi.listen(true); // go to listen mode
}

?

It’d be really handy to have the current method for handling what seems to be the most basic function of ‘device can’t find a known wifi network, go to listening mode so they can perform setup’. Semi Automatic doesn’t work reliably (see other thread) due to cloud functions not registering reliably. I haven’t seen a ‘how to’ since Feb.

Also, if someone knows why it’s ~3:40 of particle.connecting before it appears to do a brief listen then a reset (white glow) I’d be real appreciative.

It’s pretty bizarre behaviour overall, because:

  • 3 mins 30-40 of particle.connecting, thread completely blocked, nothing executing in setup()
  • Some kind of reset or interrupt happens
  • Goes back to particle connecting green light, BUT setup block is executing and starting my 60s timer to go to particle.listen if !particle.connected. So the thread here is executing in a non blocking fashion.

Cue X-Files music.

Tagging in @avtolstoy as he seems to often be deep into the code base.