I’m developing some Particle firmware for the Argon in the Manual mode and compiling using OS 1.5.2.
The documentation on the particle website specifies that a particle.process() function needs to be included in the main loop for the cloud connection to not be lost.
The initial prototype did not include this line, but the code works just fine. Obviously I have no confidence that this code will perform well long term or in a production setting, so I’m trying to understand what the particle.connect() function does and why the code works well despite not adding it.
This is how the main loop looks currently - Sensors update data at 1Hz frequency, so the particle publish pushes that data to the cloud at that frequency…
this statement you have in your code just so happens to invoke Particle.process() when delay() statements accumulate to 1000 ms. So, your loop is, at some point, calling Particle.process() in background.
Particle.process() is a blocking call, and blocks for a few milliseconds. Particle.process() is called automatically after every loop() and during delays. Typically you will not need to call Particle.process() unless you block in some other way and need to maintain the connection to the Cloud, or you change the system mode. If the user puts the device into MANUAL mode, the user is responsible for calling Particle.process() .
Yes. While in manual mode, you are responsible for placing Particle.process() in your code. So far, you have had no trouble with your code. A one second blocking delay is not affecting your connection, yet.
The delay(1000) statement happens to call Particle.process() for you but, as you add new routines, may not call it often enough. A connection could break if not attended by Particle.process() often enough.
I had read about this a long time ago. Hope the following helps. Here is what I found today in the forum:
Welcome to the forum. I have not worked with Manual mode much, I tend to stick to Semi-Automatic mode. That said, maybe this explanation by @ScruffR can shed some light on the particle.process(); command. Made me learn something new today