Little late to the game but was hoping for a point of clarification - the docs seem to hint at it, as do most of the forum post, but I figured in case it was just asked differently and I or someone else just wasn’t asking the question the right way etc…
If both SYSTEM_MODE(SEMI_AUTOMATIC) and SYSTEM_THREAD(ENABLED) as in @ScruffR’s post awhile back with this bit of code:
SYSTEM_MODE(SEMI_AUTOMATIC)
SYSTEM_THREAD(ENABLED)
void setup()
{
//pinMode(D7, OUTPUT); //Wasn't sure if that was here for a specific reason
Particle.connect();
}
void loop()
{
//do *stuff* - I simplified :)
}
Does the above mean that if WIFI & Internal nets are up but the interwebs are down, that whatever’s going on in the loop will keep on trucking till the webs come back up - and then automatically re-connect to the cloud?
Or should the code read more along the lines of:
SYSTEM_MODE(SEMI_AUTOMATIC)
SYSTEM_THREAD(ENABLED)
long timeout = 2000;
long timer = 0;
void setup()
{
//pinMode(D7, OUTPUT); //Wasn't sure if that was here for a specific reason
Particle.connect();
timer = millis();
}
void loop()
{
//do *stuff* - I simplified :)
if(millis() - timer >= timeout)
{
//I might have got the timer wrong, but you know what I'm going for there
Particle.connect();
}
}
Or would both work, but the second one would just be redundant?
From what I gather, in this setup, ‘Particle.connect()’ would not block anything because of the threading mode and system mode(?)
FWIW, the docs, while fairly comprehensive, don’t always cover things in a one size fits all kind of way - I for example need to have 5 different people tell me the same thing before I realize I asked the wrong question
I think ultimately the reason this line of questioning keeps coming up is that there’s (and maybe I’m off my rocker - I accept this) this perception that this platform is more plug and play than it really is (thats probably true of most things come to think of it…)
For a long time I just could not wrap my mind around a for loop, now I don’t understand why I had trouble with it… I think if I could understand what happened in between, it would open doors to figuring out how to meet people where there at so to speak.
I digress. a lot… thoughts on the more relevant bits?