here is another way building on my perious idea ....
given we are dealing with inherant latency
The neuron sends a packet every 15mSec to UCCNC plugin, so if the neuron pluging records the position of the work co-ordinates every 15mSec so say you you keep 6 machine co-ordinate positions + gcode line numbers (current, -15mSec, -30mSec, -45mSec, -60mSec, -75mSec)
And the neuron has an internal loop of 1khz (1mSec), if you add to the packet a loop counter number (i.e. a number from 0 to 15), this could be done as a hex digit (0x0 to 0xF)
This digit would signify if the arcOK changed state and exactly when it changed state as part of the loop (excluding debounce, exactly when it changed state)..... So say the arcOK (whilst M3 / M4 / M10 was active) changed state on the 4th loop between packet transmissions to the neuron, you know that in the ethernet packet that gets transmitted to UCCNC plugin via ethernet there would be a "0x4" ...
This would tell the neuron plugin that between the last packet transmission (4th 1mSec loop) the ARCOK was lost. This would allow the UCCNC Neuron plugin to interpolate the exact previous position of the torch (or very very close) exactly when the arcOK signal changed state.
This would alos allow for the Neuron to backtrack for any inherant system latency ...... say that we estimate with slow relays the delay + plasma cutter arcOK debounce is 50mSec, the neuron can interpolate the position of -50mSec loop stored g-code line + machine co-ordiantes against -60mSec and can obtain the exact position of where the machine was
The distance we are talking between neuron packets at 600inches per min = 3.81mm inaccuracy, if via plugin interpolation we are able to split this up into 15 counts, this would reduce the inaccuracy to 0.254mm .... anything less than 1mm should not be a problem because of the kerf width.
Obviously most of the time feedrates will not be this high so the inaccuracy will be even less.
The only problem that you will have will be interpolating G2 / G3 motion, but given you have the straight line position co-ordinates at 15mSec intervils, does it matter if you interpolate this via linear interpolation and not consider the arc as the inaccuracy will be very very small given we are now keeping track of exactly when the arcOK signal changed state (not worrying about debounce because the neuron will do that internally)
You will also need to allow for a debounce within the Neuron plugin (i.e. you will need to see two packets where the arc has been lost) this is becuse if you recieved a 0xC (12) packet this would not allow for the 5 loop debounce within the neuron 12 + 5 = 17, i.e. it will fall into the next packet.... so the next packet that landed would say 0xF (15) which incicates that the neuron needs to use the previous packet count of 0xC for interpolation.
if the next packet that landed from the neuron said 0x0 after the 0xC, then the decounce sequence within the neuron had cleared the signal and it was a false signal so the plugin would ignore the pervious change in state.
It is also worth pointing out that latency of the neuron may not be 15mSec, but slightly greater as the debounce at present may delay the ArcOK signal from being transmitted if it occurs before the 5mSec debounce has confirmed the signal has changed state and the next packet is sent out.
What do you think? (maybe I've lost te plot again).