Is it possible to get the current machine position before a move is completed?
Also out of curiosity what does the DDA stand for?
Currently, no. The position is updated at the end of each move.
The DDA class existed before I got involved with the firmware. If I ever knew what it stood for, I've forgotten.
I think it might be for digital differential analyzer, see https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
The machine I am using homes the Z at the top, then does Z probing. I wanted to turn on the Z probe and then slow down the probing as the Z axis got close to the bed. I will see if I can figure out to find the correct DriveMovement object for the Z axis and get the height.
If you use a Z probe with an analog output that increases as it gets nearer to the bed, then the probing speed will be automatically reduced to 1/3 of its initial value when the probe output reaches 90% of the trigger value.
Alternatively, use a macro to home the printer to Z max, then move to e.g. Z=5, then probe. For G32 and G29 probing, this is automatic, you set the height at which probing starts in the M558 H parameter.
If you want to tinker with the firmware to get the current position, the DriveMovement objects are pointed to from an array in the DDA indexed by axis. Take a look at the StopDrive function. After stopping the drive, it looks at the nextStep variable to calculate how far the move has progressed.
I did see the code for the analog output, but my sensor is digital.
I had thought about moving the Z axis but the way my probe works it is important that the bed is moving when the probe is turned on.
I will try getting the distance and see if I can drop the speed and turn on the probe when we hit the dive distance.
Right now I am trying to understand the code enough to feel comfortable making the changes.
jml last edited by
I would also be interested in a way to get the current position (triggered by an input being made high or low, or when an analog sense pin reaches a certain value). Maybe looking at the firmware code for how the endstops/homing works can help.
This was available in Marlin and was very useful for my printer. Hopefully get_position() can be incorporated into RRF.