Particle.disconnect does not interrupt Particle.connect

In “Semi-automatic mode” I dont find the below bold statement from the Particle docs to be true.

Once the user calls Particle.connect(), the user code will be blocked while the device attempts to negotiate a connection. This connection will block execution of loop() or setup() until either the device connects to the Cloud or an interrupt is fired that calls Particle.disconnect().

Before Particle.connect, I start a software timer which calls Particle.disconnect if its taking too long, but that does NOT interrupt Particle.connect. Particle.connect attempt to connect indefinitely.

Software Timers are no interrupts so the bold statement is still valid till proven wrong with a real interrupt.

But you might want to use SYSTEM_THREAD(ENABLED) to buy yourself some degree of independence between system thread and your own code.

1 Like