I’ve fixed the error callback in EncoderTool - you can find it
here if you want to use it. Note that when an error occurs, the normal callback is
not executed (in either my fix or the original code).
I’ve been playing with comparing EncoderTool and QuadEncoder output, using a Teensy 3.2 to generate quadrature signals and feeding those to a Teensy 4.1. As expected, it’s entirely possible to get missed edges using EncoderTool, though only at ridiculously high RPM rates given my minimal callback functions.
About the only vaguely interesting insight is that the T3.2 occasionally delays a signal edge (due to its own interrupts delaying the IntervalTimer callback), and
if that coincides with a delayed EncoderTool interrupt then counts go missing. Otherwise all is well.
The real-life equivalent is that the spindle encoder won’t be perfect, with exact 360°/4096 spacing between all its edges. You might expect its spacing inaccuracies to repeat, so knowing the worst-case spacing might help decide what the maximum allowed callback duration might be. You also need to know the longest ISR latency: that depends on your system, my simple setup is probably only about 2.5us - more instrumentation needed here to capture the rare events.