I have two devices, Argon / Xenon talking one way over mesh.
I am measuring the delay and jitter from transmission from Argon to reception callback on Xenon is executed.
On the transmitting end, the Argon, polls a button in loop() and does
if(meshConnected==1)
{
digitalWrite(D7,1);
Mesh.publish("shift","dn");
}
Reciever is just waiting for a telegram:
void setup()
{
//Serial.begin(9600);
Mesh.subscribe("shift", myHandler);
pinMode(D7,OUTPUT);
}
void myHandler(const char *event, const char *data)
{
if(ledOn)
ledOn=0;
else
ledOn=1;
digitalWrite(D7,ledOn);
}
I measure D7 on both devices, and observe a delay between 3[ms] to 7[ms], from one transmission to the next.
I assume the jitter of +/-2[ms] may be caused by the underlying scheduler, and background tasks.
Is SYSTEM_THREAD(ENABLED) the correct way to minimize jitter, and will it allow the Mesh.Publish to transmit deterministically.
How little transmission/reception timing jitter is possible with mesh/thread in the Particle implementation ?