Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust arc radius precision check for INCHES #1106

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion grbl/gcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,15 @@ uint8_t gc_execute_line(char *line)

// Compute difference between current location and target radii for final error-checks.
float delta_r = fabs(target_r-gc_block.values.r);
if (delta_r > 0.005) {

float max_delta_r = 0.005;
if (gc_block.modal.units == UNITS_MODE_INCHES) {
// We need to adjust this when using inches,
// otherwise we get false negatives STATUS_GCODE_INVALID_TARGET errors.
max_delta_r *= MM_PER_INCH;
}

if (delta_r > max_delta_r) {
if (delta_r > 0.5) { FAIL(STATUS_GCODE_INVALID_TARGET); } // [Arc definition error] > 0.5mm
if (delta_r > (0.001*gc_block.values.r)) { FAIL(STATUS_GCODE_INVALID_TARGET); } // [Arc definition error] > 0.005mm AND 0.1% radius
}
Expand Down