|
|
@ -1713,27 +1713,37 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
z_dest -= zprobe_zoffset;
|
|
|
|
z_dest -= zprobe_zoffset;
|
|
|
|
|
|
|
|
|
|
|
|
if (z_dest > current_position[Z_AXIS]) {
|
|
|
|
if (z_dest > current_position[Z_AXIS]) {
|
|
|
|
float old_feedrate = feedrate;
|
|
|
|
|
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
|
|
|
|
|
|
do_blocking_move_to_z(z_dest);
|
|
|
|
do_blocking_move_to_z(z_dest);
|
|
|
|
feedrate = old_feedrate;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif //HAS_BED_PROBE
|
|
|
|
#endif //HAS_BED_PROBE
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_SAFE_HOMING) || HAS_PROBING_PROCEDURE
|
|
|
|
#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_SAFE_HOMING) || HAS_PROBING_PROCEDURE
|
|
|
|
static void axis_unhomed_error(bool xyz=false) {
|
|
|
|
static bool axis_unhomed_error(const bool x, const bool y, const bool z) {
|
|
|
|
if (xyz) {
|
|
|
|
const bool xx = x && !axis_homed[X_AXIS],
|
|
|
|
LCD_MESSAGEPGM(MSG_XYZ_UNHOMED);
|
|
|
|
yy = y && !axis_homed[Y_AXIS],
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
zz = z && !axis_homed[Z_AXIS];
|
|
|
|
SERIAL_ECHOLNPGM(MSG_XYZ_UNHOMED);
|
|
|
|
if (xx || yy || zz) {
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
LCD_MESSAGEPGM(MSG_YX_UNHOMED);
|
|
|
|
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
SERIAL_ECHOLNPGM(MSG_YX_UNHOMED);
|
|
|
|
SERIAL_ECHOPGM(MSG_HOME " ");
|
|
|
|
|
|
|
|
if (xx) SERIAL_ECHOPGM(MSG_X);
|
|
|
|
|
|
|
|
if (yy) SERIAL_ECHOPGM(MSG_Y);
|
|
|
|
|
|
|
|
if (zz) SERIAL_ECHOPGM(MSG_Z);
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPGM(" " MSG_FIRST);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(ULTRA_LCD)
|
|
|
|
|
|
|
|
char message[3 * (LCD_WIDTH) + 1] = ""; // worst case is kana.utf with up to 3*LCD_WIDTH+1
|
|
|
|
|
|
|
|
strcat_P(message, PSTR(MSG_HOME " "));
|
|
|
|
|
|
|
|
if (xx) strcat_P(message, PSTR(MSG_X));
|
|
|
|
|
|
|
|
if (yy) strcat_P(message, PSTR(MSG_Y));
|
|
|
|
|
|
|
|
if (zz) strcat_P(message, PSTR(MSG_Z));
|
|
|
|
|
|
|
|
strcat_P(message, PSTR(" " MSG_FIRST));
|
|
|
|
|
|
|
|
lcd_setstatus(message);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -1746,45 +1756,27 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Method to dock/undock a sled designed by Charles Bell.
|
|
|
|
* Method to dock/undock a sled designed by Charles Bell.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* dock[in] If true, move to MAX_X and engage the electromagnet
|
|
|
|
* stow[in] If false, move to MAX_X and engage the solenoid
|
|
|
|
* offset[in] The additional distance to move to adjust docking location
|
|
|
|
* If true, move to MAX_X and release the solenoid
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void dock_sled(bool dock, int offset = 0) {
|
|
|
|
static void dock_sled(bool stow) {
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
SERIAL_ECHOPAIR("dock_sled(", dock);
|
|
|
|
SERIAL_ECHOPAIR("dock_sled(", stow);
|
|
|
|
SERIAL_ECHOLNPGM(")");
|
|
|
|
SERIAL_ECHOLNPGM(")");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (!axis_homed[X_AXIS] || !axis_homed[Y_AXIS] || !axis_homed[Z_AXIS]) {
|
|
|
|
if (axis_unhomed_error(true, false, false)) return;
|
|
|
|
axis_unhomed_error(true);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (endstops.z_probe_enabled == !dock) return; // already docked/undocked?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float oldXpos = current_position[X_AXIS]; // save x position
|
|
|
|
float oldXpos = current_position[X_AXIS]; // save x position
|
|
|
|
float old_feedrate = feedrate;
|
|
|
|
|
|
|
|
if (dock) {
|
|
|
|
|
|
|
|
#if _Z_RAISE_PROBE_DEPLOY_STOW > 0
|
|
|
|
|
|
|
|
do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Dock sled a bit closer to ensure proper capturing
|
|
|
|
// Dock sled a bit closer to ensure proper capturing
|
|
|
|
feedrate = XY_PROBE_FEEDRATE;
|
|
|
|
do_blocking_move_to_x(X_MAX_POS + SLED_DOCKING_OFFSET - ((stow) ? 1 : 0));
|
|
|
|
do_blocking_move_to_x(X_MAX_POS + SLED_DOCKING_OFFSET + offset - 1);
|
|
|
|
digitalWrite(SLED_PIN, !stow); // switch solenoid
|
|
|
|
digitalWrite(SLED_PIN, LOW); // turn off magnet
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
feedrate = XY_PROBE_FEEDRATE;
|
|
|
|
|
|
|
|
float z_loc = current_position[Z_AXIS];
|
|
|
|
|
|
|
|
if (z_loc < _Z_RAISE_PROBE_DEPLOY_STOW + 5) z_loc = _Z_RAISE_PROBE_DEPLOY_STOW;
|
|
|
|
|
|
|
|
do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, current_position[Y_AXIS], z_loc); // this also updates current_position
|
|
|
|
|
|
|
|
digitalWrite(SLED_PIN, HIGH); // turn on magnet
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
do_blocking_move_to_x(oldXpos); // return to position before docking
|
|
|
|
do_blocking_move_to_x(oldXpos); // return to position before docking
|
|
|
|
|
|
|
|
|
|
|
|
feedrate = old_feedrate;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // Z_PROBE_SLED
|
|
|
|
#endif // Z_PROBE_SLED
|
|
|
@ -1800,9 +1792,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
if (endstops.z_probe_enabled) return;
|
|
|
|
if (endstops.z_probe_enabled) return;
|
|
|
|
|
|
|
|
|
|
|
|
// Make room for probe
|
|
|
|
// Make room for probe
|
|
|
|
#if _Z_RAISE_PROBE_DEPLOY_STOW > 0
|
|
|
|
|
|
|
|
do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
|
|
|
|
do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_PROBE_SLED)
|
|
|
|
#if ENABLED(Z_PROBE_SLED)
|
|
|
|
|
|
|
|
|
|
|
@ -1904,9 +1894,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
if (!endstops.z_probe_enabled) return;
|
|
|
|
if (!endstops.z_probe_enabled) return;
|
|
|
|
|
|
|
|
|
|
|
|
// Make more room for the servo
|
|
|
|
// Make more room for the servo
|
|
|
|
#if _Z_RAISE_PROBE_DEPLOY_STOW > 0
|
|
|
|
|
|
|
|
do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
|
|
|
|
do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_PROBE_SLED)
|
|
|
|
#if ENABLED(Z_PROBE_SLED)
|
|
|
|
|
|
|
|
|
|
|
@ -2844,6 +2832,10 @@ inline void gcode_G28() {
|
|
|
|
|
|
|
|
|
|
|
|
#elif defined(MIN_Z_HEIGHT_FOR_HOMING) && MIN_Z_HEIGHT_FOR_HOMING > 0
|
|
|
|
#elif defined(MIN_Z_HEIGHT_FOR_HOMING) && MIN_Z_HEIGHT_FOR_HOMING > 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_BED_PROBE
|
|
|
|
|
|
|
|
do_probe_raise(MIN_Z_HEIGHT_FOR_HOMING);
|
|
|
|
|
|
|
|
destination[Z_AXIS] = current_position[Z_AXIS];
|
|
|
|
|
|
|
|
#else
|
|
|
|
// Raise Z before homing any other axes and z is not already high enough (never lower z)
|
|
|
|
// Raise Z before homing any other axes and z is not already high enough (never lower z)
|
|
|
|
if (current_position[Z_AXIS] <= MIN_Z_HEIGHT_FOR_HOMING) {
|
|
|
|
if (current_position[Z_AXIS] <= MIN_Z_HEIGHT_FOR_HOMING) {
|
|
|
|
destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING;
|
|
|
|
destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING;
|
|
|
@ -2867,6 +2859,7 @@ inline void gcode_G28() {
|
|
|
|
current_position[Z_AXIS] = destination[Z_AXIS];
|
|
|
|
current_position[Z_AXIS] = destination[Z_AXIS];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(QUICK_HOME)
|
|
|
|
#if ENABLED(QUICK_HOME)
|
|
|
|
|
|
|
|
|
|
|
@ -2922,7 +2915,12 @@ inline void gcode_G28() {
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(HOME_Y_BEFORE_X)
|
|
|
|
#if ENABLED(HOME_Y_BEFORE_X)
|
|
|
|
// Home Y
|
|
|
|
// Home Y
|
|
|
|
if (home_all_axis || homeY) HOMEAXIS(Y);
|
|
|
|
if (home_all_axis || homeY) {
|
|
|
|
|
|
|
|
HOMEAXIS(Y);
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// Home X
|
|
|
|
// Home X
|
|
|
@ -3015,7 +3013,7 @@ inline void gcode_G28() {
|
|
|
|
else if (homeZ) { // Don't need to Home Z twice
|
|
|
|
else if (homeZ) { // Don't need to Home Z twice
|
|
|
|
|
|
|
|
|
|
|
|
// Let's see if X and Y are homed
|
|
|
|
// Let's see if X and Y are homed
|
|
|
|
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS]) {
|
|
|
|
if (axis_unhomed_error(true, true, false)) return;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Make sure the Z probe is within the physical limits
|
|
|
|
* Make sure the Z probe is within the physical limits
|
|
|
@ -3036,11 +3034,6 @@ inline void gcode_G28() {
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
SERIAL_ECHOLNPGM(MSG_ZPROBE_OUT);
|
|
|
|
SERIAL_ECHOLNPGM(MSG_ZPROBE_OUT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
axis_unhomed_error();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // !home_all_axes && homeZ
|
|
|
|
} // !home_all_axes && homeZ
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
@ -3381,10 +3374,7 @@ inline void gcode_G28() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// Don't allow auto-leveling without homing first
|
|
|
|
// Don't allow auto-leveling without homing first
|
|
|
|
if (!axis_homed[X_AXIS] || !axis_homed[Y_AXIS] || !axis_homed[Z_AXIS]) {
|
|
|
|
if (axis_unhomed_error(true, true, true)) return;
|
|
|
|
axis_unhomed_error(true);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int verbose_level = code_seen('V') ? code_value_int() : 1;
|
|
|
|
int verbose_level = code_seen('V') ? code_value_int() : 1;
|
|
|
|
if (verbose_level < 0 || verbose_level > 4) {
|
|
|
|
if (verbose_level < 0 || verbose_level > 4) {
|
|
|
@ -3394,7 +3384,7 @@ inline void gcode_G28() {
|
|
|
|
|
|
|
|
|
|
|
|
bool dryrun = code_seen('D');
|
|
|
|
bool dryrun = code_seen('D');
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
|
|
|
|
#if ENABLED(Z_PROBE_ALLEN_KEY)
|
|
|
|
const bool stow_probe_after_each = false;
|
|
|
|
const bool stow_probe_after_each = false;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
bool stow_probe_after_each = code_seen('E');
|
|
|
|
bool stow_probe_after_each = code_seen('E');
|
|
|
@ -4136,10 +4126,7 @@ inline void gcode_M42() {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M48() {
|
|
|
|
inline void gcode_M48() {
|
|
|
|
|
|
|
|
|
|
|
|
if (!axis_homed[X_AXIS] || !axis_homed[Y_AXIS] || !axis_homed[Z_AXIS]) {
|
|
|
|
if (axis_unhomed_error(true, true, true)) return;
|
|
|
|
axis_unhomed_error(true);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int8_t verbose_level = code_seen('V') ? code_value_byte() : 1;
|
|
|
|
int8_t verbose_level = code_seen('V') ? code_value_byte() : 1;
|
|
|
|
if (verbose_level < 0 || verbose_level > 4) {
|
|
|
|
if (verbose_level < 0 || verbose_level > 4) {
|
|
|
@ -4159,7 +4146,7 @@ inline void gcode_M42() {
|
|
|
|
float X_current = current_position[X_AXIS],
|
|
|
|
float X_current = current_position[X_AXIS],
|
|
|
|
Y_current = current_position[Y_AXIS];
|
|
|
|
Y_current = current_position[Y_AXIS];
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
|
|
|
|
#if ENABLED(Z_PROBE_ALLEN_KEY)
|
|
|
|
const bool stow_probe_after_each = false;
|
|
|
|
const bool stow_probe_after_each = false;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
bool stow_probe_after_each = code_seen('E');
|
|
|
|
bool stow_probe_after_each = code_seen('E');
|
|
|
|