Skip to content
New issue

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

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

Already on GitHub? # to your account

Revert to position-difference method in run_z_probe() #4368

Merged
merged 1 commit into from
Jul 21, 2016
Merged
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
20 changes: 17 additions & 3 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2064,6 +2064,12 @@ static void clean_up_after_endstop_or_probe_move() {
return false;
}

#if ENABLED(DELTA)
#define SET_CURRENT_FROM_STEPPERS() current_position[Z_AXIS] = z_before - stepper.get_axis_position_mm(Z_AXIS) + z_mm
#else
#define SET_CURRENT_FROM_STEPPERS() current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS)
#endif

// Do a single Z probe and return with current_position[Z_AXIS]
// at the height where the probe triggered.
static float run_z_probe() {
Expand All @@ -2075,23 +2081,31 @@ static void clean_up_after_endstop_or_probe_move() {
planner.bed_level_matrix.set_to_identity();
#endif

#if ENABLED(DELTA)
float z_before = current_position[Z_AXIS];
float z_mm = stepper.get_axis_position_mm(Z_AXIS);
#endif
current_position[Z_AXIS] = -(Z_MAX_LENGTH + 10);
do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_FAST);
endstops.hit_on_purpose(); // clear endstop hit flags
// Get the current stepper position after bumping an endstop
current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
SYNC_PLAN_POSITION_KINEMATIC(); // tell the planner where we are feedrate_mm_m = homing_feedrate_mm_m[Z_AXIS];
SET_CURRENT_FROM_STEPPERS();
SYNC_PLAN_POSITION_KINEMATIC(); // tell the planner where we are

// move up the retract distance
current_position[Z_AXIS] += home_bump_mm(Z_AXIS);
do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_FAST);

#if ENABLED(DELTA)
z_before = current_position[Z_AXIS];
z_mm = stepper.get_axis_position_mm(Z_AXIS);
#endif
// move back down slowly to find bed
current_position[Z_AXIS] -= home_bump_mm(Z_AXIS) * 2;
do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_SLOW);
endstops.hit_on_purpose(); // clear endstop hit flags
// Get the current stepper position after bumping an endstop
current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
SET_CURRENT_FROM_STEPPERS();
SYNC_PLAN_POSITION_KINEMATIC(); // tell the planner where we are

#if ENABLED(DEBUG_LEVELING_FEATURE)
Expand Down