Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Particle.connect() should not allow loop() to run until Particle.connected() is true #973
Particle.connect() should not allow loop() to run until Particle.connected() is true
See issue particle-iot/docs#367 in Docs, make sure to update behavior when resolved.
Test App compiled with v0.5.0-rc.2 on Photon
I hear your case, but I don't feel this is a bug. That's the intended behavior of
If it were
A simple workaround is to add this in
To so summarize - the behavior is by design that semi-automatic mode doesn't stop the loop from running when the device isn't connected.
The situation would be the same with multithreaded code too - the setup()/loop() functions execute independently of the cloud state. In cases where the app wants to wait for the device to be in a given state, the
On review, I think your suggestion is the ideal behavior - in SEMI_AUTOMATIC mode, loop/setup should not be run until the cloud is connected while