This code will be used on both Boron and Argon connected to Particle Cloud.
I understand it is generally advisable to avoid blocking loop().
It is known that Particle Serial1 receive can be a bit buggy. I want to call a function that will send a Serial1 packet and await for a response with a timeout if no response arrives.
I would like to allow 50 ms before response timeout. The function that sends the first packet will be called from loop() or something based from loop, then inside that function, after the outbound packet, I want to wait up to 50ms then return, during which time, loop() would be blocked.
I think this is probably safe.
Does anyone expect this to cause problem with either wifi or cellular connectivity? I want to make sure I’m not about to introduce intermittent problems because of this.
I’m not running any other background threads except I am running a few software timers built into DeviceOS.
By running the application thread and system thread separately, even if the application thread is blocked by delay() the system thread can still perform its duties.