|
@@ -1584,7 +1584,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
1584
|
1584
|
/**
|
1585
|
1585
|
* Some planner shorthand inline functions
|
1586
|
1586
|
*/
|
1587
|
|
-inline float set_homing_bump_feedrate(AxisEnum axis) {
|
|
1587
|
+inline float get_homing_bump_feedrate(AxisEnum axis) {
|
1588
|
1588
|
const int homing_bump_divisor[] = HOMING_BUMP_DIVISOR;
|
1589
|
1589
|
int hbd = homing_bump_divisor[axis];
|
1590
|
1590
|
if (hbd < 1) {
|
|
@@ -1592,8 +1592,7 @@ inline float set_homing_bump_feedrate(AxisEnum axis) {
|
1592
|
1592
|
SERIAL_ECHO_START;
|
1593
|
1593
|
SERIAL_ECHOLNPGM("Warning: Homing Bump Divisor < 1");
|
1594
|
1594
|
}
|
1595
|
|
- feedrate_mm_m = homing_feedrate_mm_m[axis] / hbd;
|
1596
|
|
- return feedrate_mm_m;
|
|
1595
|
+ return homing_feedrate_mm_m[axis] / hbd;
|
1597
|
1596
|
}
|
1598
|
1597
|
//
|
1599
|
1598
|
// line_to_current_position
|
|
@@ -1613,7 +1612,7 @@ inline void line_to_axis_pos(AxisEnum axis, float where, float fr_mm_m = 0.0) {
|
1613
|
1612
|
current_position[axis] = where;
|
1614
|
1613
|
feedrate_mm_m = (fr_mm_m != 0.0) ? fr_mm_m : homing_feedrate_mm_m[axis];
|
1615
|
1614
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMM_TO_MMS(feedrate_mm_m), active_extruder);
|
1616
|
|
- stepper.synchronize(); // The lost one
|
|
1615
|
+ stepper.synchronize();
|
1617
|
1616
|
feedrate_mm_m = old_feedrate_mm_m;
|
1618
|
1617
|
}
|
1619
|
1618
|
|
|
@@ -2061,85 +2060,35 @@ static void clean_up_after_endstop_or_probe_move() {
|
2061
|
2060
|
// at the height where the probe triggered.
|
2062
|
2061
|
static float run_z_probe() {
|
2063
|
2062
|
|
2064
|
|
- float old_feedrate_mm_m = feedrate_mm_m;
|
2065
|
|
-
|
2066
|
2063
|
// Prevent stepper_inactive_time from running out and EXTRUDER_RUNOUT_PREVENT from extruding
|
2067
|
2064
|
refresh_cmd_timeout();
|
2068
|
2065
|
|
2069
|
|
- #if ENABLED(DELTA)
|
2070
|
|
-
|
2071
|
|
- float start_z = current_position[Z_AXIS];
|
2072
|
|
- long start_steps = stepper.position(Z_AXIS);
|
2073
|
|
-
|
2074
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
2075
|
|
- if (DEBUGGING(LEVELING)) DEBUG_POS("run_z_probe (DELTA) 1", current_position);
|
2076
|
|
- #endif
|
2077
|
|
-
|
2078
|
|
- // move down slowly until you find the bed
|
2079
|
|
- feedrate_mm_m = homing_feedrate_mm_m[Z_AXIS] / 4;
|
2080
|
|
- destination[Z_AXIS] = -10;
|
2081
|
|
- prepare_move_to_destination_raw(); // this will also set_current_to_destination
|
2082
|
|
- stepper.synchronize();
|
2083
|
|
- endstops.hit_on_purpose(); // clear endstop hit flags
|
2084
|
|
-
|
2085
|
|
- /**
|
2086
|
|
- * We have to let the planner know where we are right now as it
|
2087
|
|
- * is not where we said to go.
|
2088
|
|
- */
|
2089
|
|
- long stop_steps = stepper.position(Z_AXIS);
|
2090
|
|
- float mm = start_z - float(start_steps - stop_steps) / planner.axis_steps_per_mm[Z_AXIS];
|
2091
|
|
- current_position[Z_AXIS] = mm;
|
2092
|
|
-
|
2093
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
2094
|
|
- if (DEBUGGING(LEVELING)) DEBUG_POS("run_z_probe (DELTA) 2", current_position);
|
2095
|
|
- #endif
|
2096
|
|
-
|
2097
|
|
- #else // !DELTA
|
2098
|
|
-
|
2099
|
|
- #if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
2100
|
|
- planner.bed_level_matrix.set_to_identity();
|
2101
|
|
- #endif
|
2102
|
|
-
|
2103
|
|
- feedrate_mm_m = homing_feedrate_mm_m[Z_AXIS];
|
2104
|
|
-
|
2105
|
|
- // Move down until the Z probe (or endstop?) is triggered
|
2106
|
|
- float zPosition = -(Z_MAX_LENGTH + 10);
|
2107
|
|
- line_to_z(zPosition);
|
2108
|
|
- stepper.synchronize();
|
2109
|
|
-
|
2110
|
|
- // Tell the planner where we ended up - Get this from the stepper handler
|
2111
|
|
- zPosition = stepper.get_axis_position_mm(Z_AXIS);
|
2112
|
|
- planner.set_position_mm(
|
2113
|
|
- current_position[X_AXIS], current_position[Y_AXIS], zPosition,
|
2114
|
|
- current_position[E_AXIS]
|
2115
|
|
- );
|
2116
|
|
-
|
2117
|
|
- // move up the retract distance
|
2118
|
|
- zPosition += home_bump_mm(Z_AXIS);
|
2119
|
|
- line_to_z(zPosition);
|
2120
|
|
- stepper.synchronize();
|
2121
|
|
- endstops.hit_on_purpose(); // clear endstop hit flags
|
2122
|
|
-
|
2123
|
|
- // move back down slowly to find bed
|
2124
|
|
- set_homing_bump_feedrate(Z_AXIS);
|
2125
|
|
-
|
2126
|
|
- zPosition -= home_bump_mm(Z_AXIS) * 2;
|
2127
|
|
- line_to_z(zPosition);
|
2128
|
|
- stepper.synchronize();
|
2129
|
|
- endstops.hit_on_purpose(); // clear endstop hit flags
|
2130
|
|
-
|
2131
|
|
- // Get the current stepper position after bumping an endstop
|
2132
|
|
- current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
|
|
2066
|
+ #if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
|
2067
|
+ planner.bed_level_matrix.set_to_identity();
|
|
2068
|
+ #endif
|
2133
|
2069
|
|
2134
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
2135
|
|
- if (DEBUGGING(LEVELING)) DEBUG_POS("run_z_probe", current_position);
|
2136
|
|
- #endif
|
|
2070
|
+ current_position[Z_AXIS] = -(Z_MAX_LENGTH + 10);
|
|
2071
|
+ do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_FAST);
|
|
2072
|
+ endstops.hit_on_purpose(); // clear endstop hit flags
|
|
2073
|
+ // Get the current stepper position after bumping an endstop
|
|
2074
|
+ current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
|
|
2075
|
+ SYNC_PLAN_POSITION_KINEMATIC(); // tell the planner where we are feedrate_mm_m = homing_feedrate_mm_m[Z_AXIS];
|
2137
|
2076
|
|
2138
|
|
- #endif // !DELTA
|
|
2077
|
+ // move up the retract distance
|
|
2078
|
+ current_position[Z_AXIS] += home_bump_mm(Z_AXIS);
|
|
2079
|
+ do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_FAST);
|
2139
|
2080
|
|
2140
|
|
- SYNC_PLAN_POSITION_KINEMATIC();
|
|
2081
|
+ // move back down slowly to find bed
|
|
2082
|
+ current_position[Z_AXIS] -= home_bump_mm(Z_AXIS) * 2;
|
|
2083
|
+ do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_SLOW);
|
|
2084
|
+ endstops.hit_on_purpose(); // clear endstop hit flags
|
|
2085
|
+ // Get the current stepper position after bumping an endstop
|
|
2086
|
+ current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
|
|
2087
|
+ SYNC_PLAN_POSITION_KINEMATIC(); // tell the planner where we are
|
2141
|
2088
|
|
2142
|
|
- feedrate_mm_m = old_feedrate_mm_m;
|
|
2089
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
2090
|
+ if (DEBUGGING(LEVELING)) DEBUG_POS("run_z_probe", current_position);
|
|
2091
|
+ #endif
|
2143
|
2092
|
|
2144
|
2093
|
return current_position[Z_AXIS];
|
2145
|
2094
|
}
|
|
@@ -2424,7 +2373,7 @@ static void homeaxis(AxisEnum axis) {
|
2424
|
2373
|
line_to_axis_pos(axis, -home_bump_mm(axis) * axis_home_dir);
|
2425
|
2374
|
|
2426
|
2375
|
// Move slowly towards the endstop until triggered
|
2427
|
|
- line_to_axis_pos(axis, 2 * home_bump_mm(axis) * axis_home_dir, set_homing_bump_feedrate(axis));
|
|
2376
|
+ line_to_axis_pos(axis, 2 * home_bump_mm(axis) * axis_home_dir, get_homing_bump_feedrate(axis));
|
2428
|
2377
|
|
2429
|
2378
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
2430
|
2379
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> TRIGGER ENDSTOP", current_position);
|