if you have a simple tachometer for your spindle, one point, then you have to assume that your other axies never miss steps.
if you have a multiple point encoder, you will need to add an index. this is a single spot that will be zero and will allow the program to know it is at zero.
if you have a greyscale encoder, well, I would be very impressed. but it would make it easier for this app.
the Y axis, your spindle,
your X is your cross slide
your Z is your carriage. to drill you use changed in Z while X and Y are stationary.
odd, but the CNC was developed for mills.
this is the way a lathe is, but if you have it set differently, just know that is how I am describing it.
your Y has unlimited distance. it just happens to be rolled up like a blueprint.
assume you have 200 steps per rotation:
if you start at 0,0,0 and rotate once and you are 200 steps along on the Y
if you move your Z by 1mm, you would be able to cut 1 mm thread.
1mm up the Z, for 1 revolution, = 1 mm thread pitch.
at the end of a rotation, you are 200 steps along the Y,
single point spindle encoder.
if you have a single point tachometer, then you have to time your thread cutting based on RPM.
reports from people using single point on a lathe for thread cutting are pretty promising.
you anticipate loss of steps, so you cut the left most side of the thread (closests to the spindle) first.
and missed steps will have the cutter move into the section of the part that will be removed.
finish cuts are lighter so less missed steps and less aggravation.
time of flight is different way to cut. you know the current speed. you know the distance you need to move in that speed.
need to calculate how many steps are needed per revolution, set your time per step and then pulse your stepper based on time per step.