Automatically limiting Z travel distance to soft limits during Z probing #1274
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When performing Z probing for PCB engraving I often ran into the problem that the G38.2Z command caused a soft limit violation, accompanied by the requirement to perform a new homing cycle.
During Z probing the given Z distance in the G38.2Z command is anyhow not expected to be reached.
Instead the Z probe making contact with the PCB stops travel immediately.
So why not making Z probing more intelligent and avoiding soft limit violations ?
I implemented an automatic limiting of Z travel distance during Z probing. In case Z travel would exceed the soft limits, the Z movement is limited to the Z soft limit. Thus a soft limit error is avoided and the travel does not exceed the soft limit values.
Now I can start at any height a simple Z probing, without running into soft limit violations.
Example for my machine which has Z soft limit of 80:
G21G91G38.2Z-99F100
The given distance value -99 is automatically set to 80 during probing, i.e. no soft limit error will be triggered.
I have seen that other GRBL users are disabling the soft limits during Z probing to avoid the limit error.
My proposed solution is safer as limits are still in place.