I added a variable as an offset for the secondary rig to correct for this. Here is what is happening:
The primary rig controls timing
It sends a signal by setting an output pin to HIGH, waiting for a fixed delay, setting it back to LOW
Because we don't know how long that takes, the secondary rig also waits for a fixed delay
This was set to the same delay, but of course the secondary rig will be a bit behind because it is waiting for a signal
The variable I added shortens the secondary rig delay
I set it so the secondary rig should be 250ms "faster" -- from the data you share it looks like the secondary rig is always at least 200ms behind and sometimes up to the entire 500ms. Whatever the variance is in this lag, the best we can do is shift the average to zero, so that on average the rigs are timed perfectly but based on things outside of our control sometimes the secondary rig will be a little ahead or a little behind.
I added a variable as an offset for the secondary rig to correct for this. Here is what is happening:
I set it so the secondary rig should be 250ms "faster" -- from the data you share it looks like the secondary rig is always at least 200ms behind and sometimes up to the entire 500ms. Whatever the variance is in this lag, the best we can do is shift the average to zero, so that on average the rigs are timed perfectly but based on things outside of our control sometimes the secondary rig will be a little ahead or a little behind.