@c_jorg
I’ve been thinking ;-)
From your work it looks like the lens control is well behaved for step sizes 1, 2, 3 and 4. That is all the upper or lower focus distance change at the same place.
This stops being the case for a step size of 5. But note that the use of 'step size' here is confusing.
Attempting to rationalise this, leads me to the following assumptions:
1. The maximum number of steps the lens can make is of the order of, say, 780;
2. There are four possible step sizes, ie large, medium, fine and extra-fine (my language)
3. The above corresponds to step_size = 1, 2, 3 or 4, ie number of steps possible = (max_possible = 780)/(5-step_size)
Thus, if I wished to have the finest control over positioning the lens, I would use a step_size of 4, ie extra-fine, which would give me about 780 positions. That is step_size of 4 is really using a real step size of unity!
Another observation being, only move, ie in a loop, by single increments. That is until we understand better the full movement control of EFM lenses.
Thus, if I wished to move to position x, I would move the lens, say in step_size 4 (extra-fine), until the last upper value is lower than the current upper and that x sits between these two values. I would then move an addition number of steps in the opposite direction, by linearly interpolating between the last and the current upper, ie to work out the number of steps to move. BTW this is what I now do in my script.
As I say, just some thinking.