|
@@ -2104,6 +2104,52 @@ bool check_commands() {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+void raise_z_above(float target, bool plan)
|
|
|
+{
|
|
|
+ if (current_position[Z_AXIS] >= target)
|
|
|
+ return;
|
|
|
+
|
|
|
+
|
|
|
+ current_position[Z_AXIS] = target;
|
|
|
+
|
|
|
+ if (axis_known_position[Z_AXIS])
|
|
|
+ {
|
|
|
+
|
|
|
+ if(plan) plan_buffer_line_curposXYZE(max_feedrate[Z_AXIS], active_extruder);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ enable_z();
|
|
|
+ st_synchronize();
|
|
|
+
|
|
|
+
|
|
|
+ bool z_endstop_enabled = enable_z_endstop(true);
|
|
|
+#ifdef TMC2130
|
|
|
+ tmc2130_home_enter(Z_AXIS_MASK);
|
|
|
+#endif
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 60, active_extruder);
|
|
|
+ st_synchronize();
|
|
|
+#ifdef TMC2130
|
|
|
+ if (endstop_z_hit_on_purpose())
|
|
|
+ {
|
|
|
+
|
|
|
+ current_position[Z_AXIS] = max_pos[Z_AXIS];
|
|
|
+ plan_set_position(current_position[X_AXIS], current_position[Y_AXIS],
|
|
|
+ current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ }
|
|
|
+ tmc2130_home_exit();
|
|
|
+#endif
|
|
|
+ enable_z_endstop(z_endstop_enabled);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
#ifdef TMC2130
|
|
|
bool calibrate_z_auto()
|
|
|
{
|
|
@@ -2484,9 +2530,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon
|
|
|
|
|
|
|
|
|
if (home_all_axes) {
|
|
|
- current_position[Z_AXIS] += MESH_HOME_Z_SEARCH;
|
|
|
- feedrate = homing_feedrate[Z_AXIS];
|
|
|
- plan_buffer_line_curposXYZE(feedrate / 60, active_extruder);
|
|
|
+ raise_z_above(MESH_HOME_Z_SEARCH);
|
|
|
st_synchronize();
|
|
|
}
|
|
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
|
@@ -2597,26 +2641,21 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon
|
|
|
#ifndef Z_SAFE_HOMING
|
|
|
if(home_z) {
|
|
|
#if defined (Z_RAISE_BEFORE_HOMING) && (Z_RAISE_BEFORE_HOMING > 0)
|
|
|
- destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1);
|
|
|
- feedrate = max_feedrate[Z_AXIS];
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
|
|
+ raise_z_above(Z_RAISE_BEFORE_HOMING);
|
|
|
st_synchronize();
|
|
|
#endif
|
|
|
#if (defined(MESH_BED_LEVELING) && !defined(MK1BP))
|
|
|
- if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] ))
|
|
|
- {
|
|
|
- homeaxis(X_AXIS);
|
|
|
- homeaxis(Y_AXIS);
|
|
|
- }
|
|
|
+ raise_z_above(MESH_HOME_Z_SEARCH);
|
|
|
+ st_synchronize();
|
|
|
+ if (!axis_known_position[X_AXIS]) homeaxis(X_AXIS);
|
|
|
+ if (!axis_known_position[Y_AXIS]) homeaxis(Y_AXIS);
|
|
|
|
|
|
world2machine_initialize();
|
|
|
world2machine(pgm_read_float(bed_ref_points_4), pgm_read_float(bed_ref_points_4+1), destination[X_AXIS], destination[Y_AXIS]);
|
|
|
world2machine_reset();
|
|
|
if (destination[Y_AXIS] < Y_MIN_POS)
|
|
|
destination[Y_AXIS] = Y_MIN_POS;
|
|
|
- destination[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
- feedrate = homing_feedrate[Z_AXIS]/10;
|
|
|
- current_position[Z_AXIS] = 0;
|
|
|
+ feedrate = homing_feedrate[X_AXIS] / 20;
|
|
|
enable_endstops(false);
|
|
|
#ifdef DEBUG_BUILD
|
|
|
SERIAL_ECHOLNPGM("plan_set_position()");
|
|
@@ -3143,15 +3182,6 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
|
|
|
custom_message_type = CustomMsg::Status;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-void marlin_rise_z(void)
|
|
|
-{
|
|
|
- if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30;
|
|
|
-}
|
|
|
-
|
|
|
void gcode_M701()
|
|
|
{
|
|
|
printf_P(PSTR("gcode_M701 begin\n"));
|
|
@@ -3180,7 +3210,7 @@ void gcode_M701()
|
|
|
plan_buffer_line_curposXYZE(400 / 60, active_extruder);
|
|
|
st_synchronize();
|
|
|
|
|
|
- marlin_rise_z();
|
|
|
+ raise_z_above(MIN_Z_FOR_LOAD, false);
|
|
|
current_position[E_AXIS] += 30;
|
|
|
plan_buffer_line_curposXYZE(400 / 60, active_extruder);
|
|
|
|