Simplify dock_sled()
`dock_sled()` is never called with offset parameter - remove it. We move x only - so only that needs to be homed. Consequence is - we can home to z-min now with a sled probe! Feedrates are set and restored in `do_blocking_move()`. We already checked if the probe is deployed/stowed in deploy/stow_probe. ``` if (z_loc < _Z_RAISE_PROBE_DEPLOY_STOW + 5) z_loc = _Z_RAISE_PROBE_DEPLOY_STOW; ``` makes no sense - remove. Now the raise is the same for deploy/stow -> move before the if. Replace the if with a ternary. Instead writing LOW/HIGH use the boolean `stow` we already have. There is no reason for not using the sled probe in G29/M48 with 'E'. It takes a while but works. (tested!)
This commit is contained in:
parent
511503ede9
commit
e616093d4c
1 changed files with 12 additions and 27 deletions
|
@ -1746,45 +1746,30 @@ 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_homed[X_AXIS]) {
|
||||||
axis_unhomed_error(true);
|
axis_unhomed_error(true);
|
||||||
return;
|
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) {
|
// Dock sled a bit closer to ensure proper capturing
|
||||||
#if _Z_RAISE_PROBE_DEPLOY_STOW > 0
|
do_blocking_move_to_x(X_MAX_POS + SLED_DOCKING_OFFSET - ((stow) ? 1 : 0));
|
||||||
do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
|
digitalWrite(SLED_PIN, !stow); // switch solenoid
|
||||||
#endif
|
|
||||||
// Dock sled a bit closer to ensure proper capturing
|
|
||||||
feedrate = XY_PROBE_FEEDRATE;
|
|
||||||
do_blocking_move_to_x(X_MAX_POS + SLED_DOCKING_OFFSET + offset - 1);
|
|
||||||
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
|
||||||
|
@ -3394,7 +3379,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');
|
||||||
|
@ -4159,7 +4144,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');
|
||||||
|
|
Reference in a new issue