Yes you're right. It's step and dir signal in, not g-code. I'm taking step and dir signals from the pc that run the cnc-program mach3 in to the pyboard. I'm also taking in signals for the real actual position from the quadrature encoder to the pyboard. This will be compared by the pyboard, making sure the next change in position the cnc-program makes can't be executed before the pyboard confirms from the encoder value that the real actual position has been reached. The pyboard should output the same step and dir pulses as those that came in, adjusting for any errors by checking the encoder for real actual position, and when it matches up it's time to run the next line of pulses stored in the pyboard.So lets take a step back. On the output side, you're trying to generate step/dir for a servo/stepper and monitor using quadrature with your encoder.
On the input side, are you taking gcode in? Or step/dir signals?
This I think should happen near simultaneously as the pc outputs it's signals, but if there is any position adjustments to be made, the pyboard will lag a bit. Maby a function can be made to rise an alarm if it lags, say more then half a second, if it does you sure know that it hit something it should not.
Thanks alot for your input!