stepsPerDiv = (long)(tmpSTEPS_PER_REV *((float)gAngle/(float)MINUTES_IN_CIRCLE));
divisions = (long)((float) MINUTES_IN_CIRCLE / (float) gAngle);
If its bang on one setting, and off on another, it is most likely my bug but you should be able to calculate the error and compare your result. You should find where its bang on, the divisions will have a whole number of steps.
You could also try Chucks script as I think he moves up or down one step on alternate steps or something.
I have to think about it but I think that a better algorithm might be to decide how many divisions cause a full step of error (3 in the example) and add a an extra step every third division (for this example) so we are not using floating point any more than we need to.
I think my positioning algorithm is accurate because I recalculate the position from zero (home) each time the forward or reverse button is pushed, rather than use an incremental number of motor steps. This takes care of proper rounding and always assures that you wind up at the right position.
Chuck
I was having so many problems with the whole setup that I really can't blame the script.
Enter your email address to join: