2017-09-06 11:28:31 +00:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2019-02-12 21:06:53 +00:00
|
|
|
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2017-09-06 11:28:31 +00:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
|
|
|
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-09-08 20:35:25 +00:00
|
|
|
#include "../../inc/MarlinConfig.h"
|
|
|
|
|
|
|
|
#include "../gcode.h"
|
|
|
|
|
|
|
|
#include "../../module/stepper.h"
|
|
|
|
#include "../../module/endstops.h"
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
#if HOTENDS > 1
|
2017-09-08 20:35:25 +00:00
|
|
|
#include "../../module/tool_change.h"
|
2017-09-06 11:28:31 +00:00
|
|
|
#endif
|
|
|
|
|
2017-09-08 20:35:25 +00:00
|
|
|
#if HAS_LEVELING
|
|
|
|
#include "../../feature/bedlevel/bedlevel.h"
|
|
|
|
#endif
|
|
|
|
|
2018-02-21 01:44:02 +00:00
|
|
|
#if ENABLED(SENSORLESS_HOMING)
|
|
|
|
#include "../../feature/tmc_util.h"
|
|
|
|
#endif
|
|
|
|
|
2018-06-10 21:27:14 +00:00
|
|
|
#if HOMING_Z_WITH_PROBE || ENABLED(BLTOUCH)
|
2018-03-11 18:07:55 +00:00
|
|
|
#include "../../module/probe.h"
|
|
|
|
#endif
|
|
|
|
|
2019-03-17 10:57:25 +00:00
|
|
|
#if ENABLED(BLTOUCH)
|
|
|
|
#include "../../feature/bltouch.h"
|
|
|
|
#endif
|
|
|
|
|
2017-09-08 20:35:25 +00:00
|
|
|
#include "../../lcd/ultralcd.h"
|
|
|
|
|
2019-01-24 01:06:54 +00:00
|
|
|
#if HAS_DRIVER(L6470) // set L6470 absolute position registers to counts
|
|
|
|
#include "../../libs/L6470/L6470_Marlin.h"
|
|
|
|
#endif
|
|
|
|
|
2019-03-14 07:25:42 +00:00
|
|
|
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#include "../../core/debug_out.h"
|
|
|
|
|
2017-09-06 11:28:31 +00:00
|
|
|
#if ENABLED(QUICK_HOME)
|
|
|
|
|
|
|
|
static void quick_home_xy() {
|
|
|
|
|
|
|
|
// Pretend the current position is 0,0
|
|
|
|
current_position[X_AXIS] = current_position[Y_AXIS] = 0.0;
|
|
|
|
sync_plan_position();
|
|
|
|
|
|
|
|
const int x_axis_home_dir =
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
|
|
|
x_home_dir(active_extruder)
|
|
|
|
#else
|
|
|
|
home_dir(X_AXIS)
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
|
|
|
const float mlx = max_length(X_AXIS),
|
|
|
|
mly = max_length(Y_AXIS),
|
|
|
|
mlratio = mlx > mly ? mly / mlx : mlx / mly,
|
2018-05-13 06:10:34 +00:00
|
|
|
fr_mm_s = MIN(homing_feedrate(X_AXIS), homing_feedrate(Y_AXIS)) * SQRT(sq(mlratio) + 1.0);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-02-21 01:44:02 +00:00
|
|
|
#if ENABLED(SENSORLESS_HOMING)
|
2019-02-02 00:09:01 +00:00
|
|
|
sensorless_t stealth_states { false, false, false, false, false, false, false };
|
2018-12-07 21:34:21 +00:00
|
|
|
stealth_states.x = tmc_enable_stallguard(stepperX);
|
|
|
|
stealth_states.y = tmc_enable_stallguard(stepperY);
|
2019-02-02 00:09:01 +00:00
|
|
|
#if AXIS_HAS_STALLGUARD(X2)
|
|
|
|
stealth_states.x2 = tmc_enable_stallguard(stepperX2);
|
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STALLGUARD(Y2)
|
|
|
|
stealth_states.y2 = tmc_enable_stallguard(stepperY2);
|
|
|
|
#endif
|
2018-02-21 01:44:02 +00:00
|
|
|
#endif
|
|
|
|
|
2017-09-06 11:28:31 +00:00
|
|
|
do_blocking_move_to_xy(1.5 * mlx * x_axis_home_dir, 1.5 * mly * home_dir(Y_AXIS), fr_mm_s);
|
2018-07-01 02:54:07 +00:00
|
|
|
|
|
|
|
endstops.validate_homing_move();
|
|
|
|
|
2017-09-06 11:28:31 +00:00
|
|
|
current_position[X_AXIS] = current_position[Y_AXIS] = 0.0;
|
2018-02-21 01:44:02 +00:00
|
|
|
|
2018-02-19 16:11:11 +00:00
|
|
|
#if ENABLED(SENSORLESS_HOMING)
|
2018-12-07 21:34:21 +00:00
|
|
|
tmc_disable_stallguard(stepperX, stealth_states.x);
|
|
|
|
tmc_disable_stallguard(stepperY, stealth_states.y);
|
2019-02-02 00:09:01 +00:00
|
|
|
#if AXIS_HAS_STALLGUARD(X2)
|
|
|
|
tmc_disable_stallguard(stepperX2, stealth_states.x2);
|
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STALLGUARD(Y2)
|
|
|
|
tmc_disable_stallguard(stepperY2, stealth_states.y2);
|
|
|
|
#endif
|
2018-02-19 16:11:11 +00:00
|
|
|
#endif
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // QUICK_HOME
|
|
|
|
|
|
|
|
#if ENABLED(Z_SAFE_HOMING)
|
|
|
|
|
|
|
|
inline void home_z_safely() {
|
|
|
|
|
|
|
|
// Disallow Z homing if X or Y are unknown
|
2018-06-12 02:29:31 +00:00
|
|
|
if (!TEST(axis_known_position, X_AXIS) || !TEST(axis_known_position, Y_AXIS)) {
|
2017-09-06 11:28:31 +00:00
|
|
|
LCD_MESSAGEPGM(MSG_ERR_Z_HOMING);
|
2018-11-29 22:58:58 +00:00
|
|
|
SERIAL_ECHO_MSG(MSG_ERR_Z_HOMING);
|
2017-09-06 11:28:31 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-03-14 07:25:42 +00:00
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Z_SAFE_HOMING >>>");
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-09-17 02:24:15 +00:00
|
|
|
sync_plan_position();
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Move the Z probe (or just the nozzle) to the safe homing point
|
|
|
|
*/
|
2017-11-03 04:59:42 +00:00
|
|
|
destination[X_AXIS] = Z_SAFE_HOMING_X_POINT;
|
|
|
|
destination[Y_AXIS] = Z_SAFE_HOMING_Y_POINT;
|
2017-09-06 11:28:31 +00:00
|
|
|
destination[Z_AXIS] = current_position[Z_AXIS]; // Z is already at the right height
|
|
|
|
|
|
|
|
#if HOMING_Z_WITH_PROBE
|
|
|
|
destination[X_AXIS] -= X_PROBE_OFFSET_FROM_EXTRUDER;
|
|
|
|
destination[Y_AXIS] -= Y_PROBE_OFFSET_FROM_EXTRUDER;
|
|
|
|
#endif
|
|
|
|
|
2017-11-03 04:59:42 +00:00
|
|
|
if (position_is_reachable(destination[X_AXIS], destination[Y_AXIS])) {
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2019-03-14 07:25:42 +00:00
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("Z_SAFE_HOMING", destination);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
// This causes the carriage on Dual X to unpark
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
|
|
|
active_extruder_parked = false;
|
|
|
|
#endif
|
|
|
|
|
2018-02-19 01:28:40 +00:00
|
|
|
#if ENABLED(SENSORLESS_HOMING)
|
|
|
|
safe_delay(500); // Short delay needed to settle
|
|
|
|
#endif
|
|
|
|
|
2017-09-06 11:28:31 +00:00
|
|
|
do_blocking_move_to_xy(destination[X_AXIS], destination[Y_AXIS]);
|
2018-06-30 23:13:13 +00:00
|
|
|
homeaxis(Z_AXIS);
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
LCD_MESSAGEPGM(MSG_ZPROBE_OUT);
|
2018-11-29 22:58:58 +00:00
|
|
|
SERIAL_ECHO_MSG(MSG_ZPROBE_OUT);
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|
|
|
|
|
2019-03-14 07:25:42 +00:00
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< Z_SAFE_HOMING");
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // Z_SAFE_HOMING
|
|
|
|
|
|
|
|
/**
|
|
|
|
* G28: Home all axes according to settings
|
|
|
|
*
|
|
|
|
* Parameters
|
|
|
|
*
|
|
|
|
* None Home to all axes with no parameters.
|
|
|
|
* With QUICK_HOME enabled XY will home together, then Z.
|
|
|
|
*
|
2018-06-12 02:51:48 +00:00
|
|
|
* O Home only if position is unknown
|
|
|
|
*
|
2018-04-22 00:07:48 +00:00
|
|
|
* Rn Raise by n mm/inches before homing
|
|
|
|
*
|
|
|
|
* Cartesian/SCARA parameters
|
2017-09-06 11:28:31 +00:00
|
|
|
*
|
|
|
|
* X Home to the X endstop
|
|
|
|
* Y Home to the Y endstop
|
|
|
|
* Z Home to the Z endstop
|
|
|
|
*
|
|
|
|
*/
|
2017-09-08 20:35:25 +00:00
|
|
|
void GcodeSuite::G28(const bool always_home_all) {
|
2019-03-14 07:25:42 +00:00
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
DEBUG_ECHOLNPGM(">>> G28");
|
|
|
|
log_machine_info();
|
|
|
|
}
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-09-02 15:18:59 +00:00
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
|
|
|
bool IDEX_saved_duplication_state = extruder_duplication_enabled;
|
|
|
|
DualXMode IDEX_saved_mode = dual_x_carriage_mode;
|
|
|
|
#endif
|
|
|
|
|
2018-07-03 03:27:05 +00:00
|
|
|
#if ENABLED(MARLIN_DEV_MODE)
|
|
|
|
if (parser.seen('S')) {
|
|
|
|
LOOP_XYZ(a) set_axis_is_at_home((AxisEnum)a);
|
2018-09-17 02:24:15 +00:00
|
|
|
sync_plan_position();
|
2018-07-03 03:27:05 +00:00
|
|
|
SERIAL_ECHOLNPGM("Simulated Homing");
|
|
|
|
report_current_position();
|
2019-03-14 07:25:42 +00:00
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G28");
|
2018-07-03 03:27:05 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-11-05 08:19:55 +00:00
|
|
|
if (parser.boolval('O')) {
|
|
|
|
if (
|
|
|
|
#if ENABLED(HOME_AFTER_DEACTIVATE)
|
|
|
|
all_axes_known() // homing needed anytime steppers deactivate
|
|
|
|
#else
|
|
|
|
all_axes_homed() // homing needed only if never homed
|
|
|
|
#endif
|
|
|
|
) {
|
2019-03-14 07:25:42 +00:00
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> homing not needed, skip\n<<< G28");
|
2018-11-05 08:19:55 +00:00
|
|
|
return;
|
|
|
|
}
|
2018-06-12 02:51:48 +00:00
|
|
|
}
|
2018-06-12 23:38:00 +00:00
|
|
|
|
2017-09-06 11:28:31 +00:00
|
|
|
// Wait for planner moves to finish!
|
2018-05-12 06:38:02 +00:00
|
|
|
planner.synchronize();
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
// Disable the leveling matrix before homing
|
|
|
|
#if HAS_LEVELING
|
2018-09-10 03:06:03 +00:00
|
|
|
|
|
|
|
// Cancel the active G29 session
|
|
|
|
#if ENABLED(PROBE_MANUALLY)
|
|
|
|
g29_in_progress = false;
|
|
|
|
#endif
|
|
|
|
|
2018-02-23 18:41:00 +00:00
|
|
|
#if ENABLED(RESTORE_LEVELING_AFTER_G28)
|
2018-03-29 23:16:20 +00:00
|
|
|
const bool leveling_was_active = planner.leveling_active;
|
2017-09-06 11:28:31 +00:00
|
|
|
#endif
|
|
|
|
set_bed_leveling_enabled(false);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(CNC_WORKSPACE_PLANES)
|
|
|
|
workspace_plane = PLANE_XY;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Always home with tool 0 active
|
|
|
|
#if HOTENDS > 1
|
2018-03-16 05:46:42 +00:00
|
|
|
#if DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)
|
|
|
|
const uint8_t old_tool_index = active_extruder;
|
|
|
|
#endif
|
2017-09-06 11:28:31 +00:00
|
|
|
tool_change(0, 0, true);
|
|
|
|
#endif
|
|
|
|
|
2019-03-13 05:42:50 +00:00
|
|
|
#if HAS_DUPLICATION_MODE
|
2017-09-06 11:28:31 +00:00
|
|
|
extruder_duplication_enabled = false;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
setup_for_endstop_or_probe_move();
|
2019-02-25 20:28:01 +00:00
|
|
|
|
2017-09-06 11:28:31 +00:00
|
|
|
endstops.enable(true); // Enable endstops for next homing move
|
|
|
|
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
|
|
|
|
home_delta();
|
|
|
|
UNUSED(always_home_all);
|
|
|
|
|
|
|
|
#else // NOT DELTA
|
|
|
|
|
2019-05-26 20:30:20 +00:00
|
|
|
const bool homeX = parser.seen('X'), homeY = parser.seen('Y'), homeZ = parser.seen('Z'),
|
|
|
|
home_all = always_home_all || (homeX == homeY && homeX == homeZ),
|
|
|
|
doX = home_all || homeX, doY = home_all || homeY, doZ = home_all || homeZ;
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2017-10-21 16:42:26 +00:00
|
|
|
set_destination_from_current();
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
#if Z_HOME_DIR > 0 // If homing away from BED do Z first
|
|
|
|
|
2019-04-04 07:47:19 +00:00
|
|
|
if (doZ) homeaxis(Z_AXIS);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2017-12-06 01:40:36 +00:00
|
|
|
#endif
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-04-22 00:07:48 +00:00
|
|
|
const float z_homing_height = (
|
|
|
|
#if ENABLED(UNKNOWN_Z_NO_RAISE)
|
2018-06-12 02:29:31 +00:00
|
|
|
!TEST(axis_known_position, Z_AXIS) ? 0 :
|
2018-04-22 00:07:48 +00:00
|
|
|
#endif
|
|
|
|
(parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT)
|
|
|
|
);
|
2018-04-23 23:00:06 +00:00
|
|
|
|
2019-04-04 07:47:19 +00:00
|
|
|
if (z_homing_height && (doX || doY)) {
|
2017-12-06 01:40:36 +00:00
|
|
|
// Raise Z before homing any other axes and z is not already high enough (never lower z)
|
2018-03-10 05:18:47 +00:00
|
|
|
destination[Z_AXIS] = z_homing_height;
|
2017-12-06 01:40:36 +00:00
|
|
|
if (destination[Z_AXIS] > current_position[Z_AXIS]) {
|
2019-03-14 07:25:42 +00:00
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Raise Z (before homing) to ", destination[Z_AXIS]);
|
2017-12-06 01:40:36 +00:00
|
|
|
do_blocking_move_to_z(destination[Z_AXIS]);
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|
2017-12-06 01:40:36 +00:00
|
|
|
}
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
#if ENABLED(QUICK_HOME)
|
|
|
|
|
2019-04-04 07:47:19 +00:00
|
|
|
if (doX && doY) quick_home_xy();
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2018-02-16 15:59:44 +00:00
|
|
|
// Home Y (before X)
|
2017-09-06 11:28:31 +00:00
|
|
|
#if ENABLED(HOME_Y_BEFORE_X)
|
|
|
|
|
2019-04-04 07:47:19 +00:00
|
|
|
if (doY
|
2018-02-16 15:59:44 +00:00
|
|
|
#if ENABLED(CODEPENDENT_XY_HOMING)
|
2019-04-04 07:47:19 +00:00
|
|
|
|| doX
|
2018-02-16 15:59:44 +00:00
|
|
|
#endif
|
2018-06-30 23:13:13 +00:00
|
|
|
) homeaxis(Y_AXIS);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Home X
|
2019-04-04 07:47:19 +00:00
|
|
|
if (doX
|
2018-02-16 15:59:44 +00:00
|
|
|
#if ENABLED(CODEPENDENT_XY_HOMING) && DISABLED(HOME_Y_BEFORE_X)
|
2019-04-04 07:47:19 +00:00
|
|
|
|| doY
|
2018-02-16 15:59:44 +00:00
|
|
|
#endif
|
|
|
|
) {
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
|
|
|
|
|
|
|
// Always home the 2nd (right) extruder first
|
|
|
|
active_extruder = 1;
|
2018-06-30 23:13:13 +00:00
|
|
|
homeaxis(X_AXIS);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
// Remember this extruder's position for later tool change
|
2017-11-03 04:59:42 +00:00
|
|
|
inactive_extruder_x_pos = current_position[X_AXIS];
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
// Home the 1st (left) extruder
|
|
|
|
active_extruder = 0;
|
2018-06-30 23:13:13 +00:00
|
|
|
homeaxis(X_AXIS);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
// Consider the active extruder to be parked
|
|
|
|
COPY(raised_parked_position, current_position);
|
|
|
|
delayed_move_time = 0;
|
|
|
|
active_extruder_parked = true;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2018-06-30 23:13:13 +00:00
|
|
|
homeaxis(X_AXIS);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-02-16 15:59:44 +00:00
|
|
|
// Home Y (after X)
|
2017-09-06 11:28:31 +00:00
|
|
|
#if DISABLED(HOME_Y_BEFORE_X)
|
2019-04-04 07:47:19 +00:00
|
|
|
if (doY) homeaxis(Y_AXIS);
|
2017-09-06 11:28:31 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Home Z last if homing towards the bed
|
|
|
|
#if Z_HOME_DIR < 0
|
2019-04-04 07:47:19 +00:00
|
|
|
if (doZ) {
|
2019-05-18 00:10:18 +00:00
|
|
|
#if ENABLED(BLTOUCH)
|
|
|
|
bltouch.init();
|
|
|
|
#endif
|
2017-09-06 11:28:31 +00:00
|
|
|
#if ENABLED(Z_SAFE_HOMING)
|
|
|
|
home_z_safely();
|
|
|
|
#else
|
2018-06-30 23:13:13 +00:00
|
|
|
homeaxis(Z_AXIS);
|
2017-09-06 11:28:31 +00:00
|
|
|
#endif
|
2018-04-22 06:23:26 +00:00
|
|
|
|
2018-04-30 08:25:47 +00:00
|
|
|
#if HOMING_Z_WITH_PROBE && defined(Z_AFTER_PROBING)
|
2018-04-22 06:23:26 +00:00
|
|
|
move_z_after_probing();
|
|
|
|
#endif
|
|
|
|
|
2019-04-04 07:47:19 +00:00
|
|
|
} // doZ
|
2017-09-06 11:28:31 +00:00
|
|
|
#endif // Z_HOME_DIR < 0
|
|
|
|
|
2018-09-17 02:24:15 +00:00
|
|
|
sync_plan_position();
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2017-09-08 20:35:25 +00:00
|
|
|
#endif // !DELTA (G28)
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-09-04 04:15:31 +00:00
|
|
|
/**
|
|
|
|
* Preserve DXC mode across a G28 for IDEX printers in DXC_DUPLICATION_MODE.
|
|
|
|
* This is important because it lets a user use the LCD Panel to set an IDEX Duplication mode, and
|
|
|
|
* then print a standard GCode file that contains a single print that does a G28 and has no other
|
|
|
|
* IDEX specific commands in it.
|
|
|
|
*/
|
2018-09-02 15:18:59 +00:00
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
2018-09-04 04:15:31 +00:00
|
|
|
|
2018-09-17 06:06:22 +00:00
|
|
|
if (dxc_is_duplicating()) {
|
2018-09-02 15:18:59 +00:00
|
|
|
|
2018-09-04 04:15:31 +00:00
|
|
|
// Always home the 2nd (right) extruder first
|
|
|
|
active_extruder = 1;
|
|
|
|
homeaxis(X_AXIS);
|
2018-09-02 15:18:59 +00:00
|
|
|
|
2018-09-04 04:15:31 +00:00
|
|
|
// Remember this extruder's position for later tool change
|
|
|
|
inactive_extruder_x_pos = current_position[X_AXIS];
|
2018-09-02 15:18:59 +00:00
|
|
|
|
2018-09-04 04:15:31 +00:00
|
|
|
// Home the 1st (left) extruder
|
|
|
|
active_extruder = 0;
|
|
|
|
homeaxis(X_AXIS);
|
2018-09-02 15:18:59 +00:00
|
|
|
|
2018-09-04 04:15:31 +00:00
|
|
|
// Consider the active extruder to be parked
|
|
|
|
COPY(raised_parked_position, current_position);
|
|
|
|
delayed_move_time = 0;
|
|
|
|
active_extruder_parked = true;
|
|
|
|
extruder_duplication_enabled = IDEX_saved_duplication_state;
|
2018-09-17 06:06:22 +00:00
|
|
|
extruder_duplication_enabled = false;
|
|
|
|
|
2018-09-04 04:15:31 +00:00
|
|
|
dual_x_carriage_mode = IDEX_saved_mode;
|
2018-09-17 06:06:22 +00:00
|
|
|
stepper.set_directions();
|
2018-09-02 15:18:59 +00:00
|
|
|
}
|
2018-09-04 04:15:31 +00:00
|
|
|
|
|
|
|
#endif // DUAL_X_CARRIAGE
|
2018-09-02 15:18:59 +00:00
|
|
|
|
2019-04-04 07:47:19 +00:00
|
|
|
#ifdef HOMING_BACKOFF_MM
|
|
|
|
endstops.enable(false);
|
2019-04-06 00:04:46 +00:00
|
|
|
constexpr float endstop_backoff[XYZ] = HOMING_BACKOFF_MM;
|
2019-04-04 07:47:19 +00:00
|
|
|
const float backoff_x = doX ? ABS(endstop_backoff[X_AXIS]) * (X_HOME_DIR) : 0,
|
|
|
|
backoff_y = doY ? ABS(endstop_backoff[Y_AXIS]) * (Y_HOME_DIR) : 0,
|
|
|
|
backoff_z = doZ ? ABS(endstop_backoff[Z_AXIS]) * (Z_HOME_DIR) : 0;
|
|
|
|
if (backoff_z) do_blocking_move_to_z(current_position[Z_AXIS] - backoff_z);
|
|
|
|
if (backoff_x || backoff_y) do_blocking_move_to_xy(current_position[X_AXIS] - backoff_x, current_position[Y_AXIS] - backoff_y);
|
|
|
|
#endif
|
2017-09-06 11:28:31 +00:00
|
|
|
endstops.not_homing();
|
|
|
|
|
2019-03-17 04:43:06 +00:00
|
|
|
#if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE)
|
2017-09-06 11:28:31 +00:00
|
|
|
// move to a height where we can use the full xy-area
|
|
|
|
do_blocking_move_to_z(delta_clip_start_height);
|
|
|
|
#endif
|
|
|
|
|
2018-09-09 09:19:48 +00:00
|
|
|
#if HAS_LEVELING && ENABLED(RESTORE_LEVELING_AFTER_G28)
|
2018-03-29 23:16:20 +00:00
|
|
|
set_bed_leveling_enabled(leveling_was_active);
|
2017-09-06 11:28:31 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
clean_up_after_endstop_or_probe_move();
|
|
|
|
|
|
|
|
// Restore the active tool after homing
|
2018-03-16 05:46:42 +00:00
|
|
|
#if HOTENDS > 1 && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE))
|
2019-04-06 23:04:34 +00:00
|
|
|
#if EITHER(PARKING_EXTRUDER, DUAL_X_CARRIAGE)
|
2017-11-26 02:45:43 +00:00
|
|
|
#define NO_FETCH false // fetch the previous toolhead
|
|
|
|
#else
|
|
|
|
#define NO_FETCH true
|
|
|
|
#endif
|
|
|
|
tool_change(old_tool_index, 0, NO_FETCH);
|
2017-09-06 11:28:31 +00:00
|
|
|
#endif
|
|
|
|
|
2018-11-11 18:16:24 +00:00
|
|
|
ui.refresh();
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
report_current_position();
|
2017-12-15 19:34:41 +00:00
|
|
|
#if ENABLED(NANODLP_Z_SYNC)
|
|
|
|
#if ENABLED(NANODLP_ALL_AXIS)
|
2019-04-04 07:47:19 +00:00
|
|
|
#define _HOME_SYNC true // For any axis, output sync text.
|
2017-12-15 19:34:41 +00:00
|
|
|
#else
|
2019-04-04 07:47:19 +00:00
|
|
|
#define _HOME_SYNC doZ // Only for Z-axis
|
2017-12-15 19:34:41 +00:00
|
|
|
#endif
|
|
|
|
if (_HOME_SYNC)
|
|
|
|
SERIAL_ECHOLNPGM(MSG_Z_MOVE_COMP);
|
|
|
|
#endif
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2019-03-14 07:25:42 +00:00
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G28");
|
2019-01-24 01:06:54 +00:00
|
|
|
|
|
|
|
#if HAS_DRIVER(L6470)
|
|
|
|
// Set L6470 absolute position registers to counts
|
|
|
|
for (uint8_t j = 1; j <= L6470::chain[0]; j++) {
|
|
|
|
const uint8_t cv = L6470::chain[j];
|
|
|
|
L6470.set_param(cv, L6470_ABS_POS, stepper.position((AxisEnum)L6470.axis_xref[cv]));
|
|
|
|
}
|
|
|
|
#endif
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|