How can I keep a precision ratio between two axes when the main loop timestep is too big?
Say the main loop timestep is 0.1 seconds. If the stepper pulse width is 0.01 for x and 0.05 for y. Then with my current code, on each tick they both step(because 0.1 > (0.01 || 0.05)) and you end up with a uniform diagonal line instead of a line with 1/5 slope.
I can't just use a fixed timestep and run through/catch-up on the frames because my actual application, driving stepper motors, there needs to be real-world time between each movement. Each step moves a certain linear distance.
I tried using the overflow/error time but it doesn't correct it.
The problem isn't calculating a linear path, it is translating that into pulse steps.
I am going to be running on a
Teensy 3.0/3.1. I am using the
elapsedMicros type to write non-blocking code.
Demos:Here is a barebones JavaScript simulation demo:
http://jsfiddle.net/MadLittleMods/6n3s3p1d/6/I am going to port over this code once it is working correctly. I am using JavaScript for easy prototyping and debugging.