Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions grbl/motion_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ uint8_t mc_probe_cycle(float *target, plan_line_data_t *pl_data, uint8_t parser_
return(GC_PROBE_FAIL_INIT); // Nothing else to do but bail.
}

// Z Probing simplification : if Z travel exceeds soft limits, adjust Z to max. allowed value as probing stop is anyhow expected
system_do_limit_Z_travel(target);

// Setup and queue probing motion. Auto cycle-start should not start the cycle.
mc_line(target, pl_data);

Expand Down
18 changes: 18 additions & 0 deletions grbl/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,24 @@ uint8_t system_check_travel_limits(float *target)
return(false);
}

// Z Probing simplification : if Z travel exceeds soft limits, adjust Z to max. allowed value as probing stop is anyhow expected
// function code derived from above soft limit check
uint8_t system_do_limit_Z_travel(float *target)
{
#ifdef HOMING_FORCE_SET_ORIGIN
// When homing forced set origin is enabled, soft limits checks need to account for directionality.
// NOTE: max_travel is stored as negative
if (bit_istrue(settings.homing_dir_mask,bit(Z_AXIS))) {
if (target[Z_AXIS] < 0 || target[Z_AXIS] > -settings.max_travel[Z_AXIS]) { target[Z_AXIS] = -settings.max_travel[Z_AXIS]; return(true); }
} else {
if (target[Z_AXIS] > 0 || target[Z_AXIS] < settings.max_travel[Z_AXIS]) { target[Z_AXIS] = settings.max_travel[Z_AXIS]; return(true); }
}
#else
// NOTE: max_travel is stored as negative
if (target[Z_AXIS] > 0 || target[Z_AXIS] < settings.max_travel[Z_AXIS]) { target[Z_AXIS] = settings.max_travel[Z_AXIS]; return(true); }
#endif
return(false);
}

// Special handlers for setting and clearing Grbl's real-time execution flags.
void system_set_exec_state_flag(uint8_t mask) {
Expand Down
3 changes: 3 additions & 0 deletions grbl/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ void system_convert_array_steps_to_mpos(float *position, int32_t *steps);
// Checks and reports if target array exceeds machine travel limits.
uint8_t system_check_travel_limits(float *target);

// Z Probing simplification : if Z travel exceeds soft limits, adjust Z to max. allowed value as probing stop is anyhow expected
uint8_t system_do_limit_Z_travel(float *target);

// Special handlers for setting and clearing Grbl's real-time execution flags.
void system_set_exec_state_flag(uint8_t mask);
void system_clear_exec_state_flag(uint8_t mask);
Expand Down