Hello,
I was trying to understand how a couple C++ programming concepts behave with particle P1 .
In a Multi-threaded application, where networking is set to SEMI_AUTO (we want to perform local hardware calculations first before calling networking stack), and given that delay in Multi-threaded with p1, will yield the control back to the loop which is in microcontrollers queue,
- How does particle distribute CPU resources/time when main loop thread, calls for a networking thread based function, and encounters a delay in the networking thread.
Would the control transfer back to the main loop and continue execution until the delay period is over in the main loop, or this time the control will be held by the networking thread, until the entire exercise is executed.
in other words, when main loop calls for a networking loop, and networking loop has a delay, where does the program go, if no other loops/timers/interrupts are present. Would Program suspend until delay time is executed.
For example code in the main loop,
A function for connection status check calls for
SYSTEM_MODE(SEMI_AUTOMATIC);
SYSTEM_THREAD(ENABLED);
if(particle.connected()){ }
Else if(!WiFi.connected())
{ Void tryconnect(); //in Another Header File: }
Void tryconnect() {
WiFi.on();
delay(100);
WiFi.connect();
delay(400);
Particle.connect();
delay(400);
}