Closed Wallacoloo closed 9 years ago
The most difficult part of turning this into a routine is managing the asynchronous behavior in an (intentionally) single-threaded application.
A simple home routine consists of:
More complicated homing routines might home each axis individually, or even perform some auto-leveling steps.
The best way to wait for the movement to complete might actually be to make the 2nd step appear to block until the movement is complete. The state would enter another event loop (such that the stacktrace would show two different stack frames that are both in the event loop function), and set a flag instructing it to exit the event loop after the current move completes. Once it exited the second event loop, the flag would be reset and control would immediately return to the homing routine, but the homing routine would still later return control to the first event loop.
Bypassing leveling/bounds checking is best done through flags to the State's / motionPlanner's moveTo
functions.
Implemented in devel & passes all tests, but not verified on an actual machine.
Homing can really be seen as a higher-level function than just stepping motors at precise intervals and watching the endstops. Instead, it should be thought of as a relative linear movement made while watching the endstops (for a delta bot, anyway).
In this case, the CoordMap should have a function called
home()
, which delegates the appropriate movements to the State, which in turn directs the LinearAxisSteppers (rather than AxisHomeSteppers). The LinearAxisSteppers behave almost exactly how they usually would, but the movement buffer is shortened significantly and the endstops are checked before each step.