🧑‍💻 Misc. updates for extra axes (#23521)

This commit is contained in:
Scott Lahteine
2022-01-14 03:14:13 -06:00
committed by Scott Lahteine
parent 39e4310c7b
commit 5617edbb96
27 changed files with 289 additions and 205 deletions

View File

@ -467,8 +467,8 @@ void _internal_move_to_destination(const_feedRate_t fr_mm_s/*=0.0f*/
}
/**
* Plan a move to (X, Y, Z, [I, [J, [K]]]) and set the current_position
* Plan a move to (X, Y, Z) with separation of Z from other components.
* Plan a move to (X, Y, Z, [I, [J, [K...]]]) and set the current_position
* Plan a move to (X, Y, Z, [I, [J, [K...]]]) with separation of Z from other components.
*
* - If Z is moving up, the Z move is done before XY, etc.
* - If Z is moving down, the Z move is done after XY, etc.
@ -484,6 +484,15 @@ void do_blocking_move_to(LINEAR_AXIS_ARGS(const float), const_feedRate_t fr_mm_s
#if HAS_Z_AXIS
const feedRate_t z_feedrate = fr_mm_s ?: homing_feedrate(Z_AXIS);
#endif
#if HAS_I_AXIS
const feedRate_t i_feedrate = fr_mm_s ?: homing_feedrate(I_AXIS);
#endif
#if HAS_J_AXIS
const feedRate_t j_feedrate = fr_mm_s ?: homing_feedrate(J_AXIS);
#endif
#if HAS_K_AXIS
const feedRate_t k_feedrate = fr_mm_s ?: homing_feedrate(K_AXIS);
#endif
#if IS_KINEMATIC
if (!position_is_reachable(x, y)) return;
@ -498,8 +507,8 @@ void do_blocking_move_to(LINEAR_AXIS_ARGS(const float), const_feedRate_t fr_mm_s
// when in the danger zone
if (current_position.z > delta_clip_start_height) {
if (z > delta_clip_start_height) { // staying in the danger zone
destination.set(x, y, z); // move directly (uninterpolated)
if (z > delta_clip_start_height) { // staying in the danger zone
destination.set(x, y, z); // move directly (uninterpolated)
prepare_internal_fast_move_to_destination(); // set current_position from destination
if (DEBUGGING(LEVELING)) DEBUG_POS("danger zone move", current_position);
return;
@ -509,7 +518,7 @@ void do_blocking_move_to(LINEAR_AXIS_ARGS(const float), const_feedRate_t fr_mm_s
if (DEBUGGING(LEVELING)) DEBUG_POS("zone border move", current_position);
}
if (z > current_position.z) { // raising?
if (z > current_position.z) { // raising?
destination.z = z;
prepare_internal_fast_move_to_destination(z_feedrate); // set current_position from destination
if (DEBUGGING(LEVELING)) DEBUG_POS("z raise move", current_position);
@ -519,7 +528,7 @@ void do_blocking_move_to(LINEAR_AXIS_ARGS(const float), const_feedRate_t fr_mm_s
prepare_internal_move_to_destination(); // set current_position from destination
if (DEBUGGING(LEVELING)) DEBUG_POS("xy move", current_position);
if (z < current_position.z) { // lowering?
if (z < current_position.z) { // lowering?
destination.z = z;
prepare_internal_fast_move_to_destination(z_feedrate); // set current_position from destination
if (DEBUGGING(LEVELING)) DEBUG_POS("z lower move", current_position);
@ -528,39 +537,32 @@ void do_blocking_move_to(LINEAR_AXIS_ARGS(const float), const_feedRate_t fr_mm_s
#elif IS_SCARA
// If Z needs to raise, do it before moving XY
if (destination.z < z) {
destination.z = z;
prepare_internal_fast_move_to_destination(z_feedrate);
}
if (destination.z < z) { destination.z = z; prepare_internal_fast_move_to_destination(z_feedrate); }
destination.set(x, y);
prepare_internal_fast_move_to_destination(xy_feedrate);
destination.set(x, y); prepare_internal_fast_move_to_destination(xy_feedrate);
// If Z needs to lower, do it after moving XY
if (destination.z > z) {
destination.z = z;
prepare_internal_fast_move_to_destination(z_feedrate);
}
if (destination.z > z) { destination.z = z; prepare_internal_fast_move_to_destination(z_feedrate); }
#else
#if HAS_Z_AXIS
// If Z needs to raise, do it before moving XY
if (current_position.z < z) {
current_position.z = z;
line_to_current_position(z_feedrate);
}
#if HAS_Z_AXIS // If Z needs to raise, do it before moving XY
if (current_position.z < z) { current_position.z = z; line_to_current_position(z_feedrate); }
#endif
current_position.set(x, y);
line_to_current_position(xy_feedrate);
current_position.set(x, y); line_to_current_position(xy_feedrate);
#if HAS_Z_AXIS
// If Z needs to lower, do it after moving XY
if (current_position.z > z) {
current_position.z = z;
line_to_current_position(z_feedrate);
}
#if HAS_I_AXIS
current_position.i = i; line_to_current_position(i_feedrate);
#endif
#if HAS_J_AXIS
current_position.j = j; line_to_current_position(j_feedrate);
#endif
#if HAS_K_AXIS
current_position.k = k; line_to_current_position(k_feedrate);
#endif
#if HAS_Z_AXIS // If Z needs to lower, do it after moving XY...
if (current_position.z > z) { current_position.z = z; line_to_current_position(z_feedrate); }
#endif
#endif
@ -1402,6 +1404,15 @@ void prepare_line_to_destination() {
#endif
break;
#endif
#if I_SENSORLESS
case I_AXIS: stealth_states.i = tmc_enable_stallguard(stepperI); break;
#endif
#if J_SENSORLESS
case J_AXIS: stealth_states.j = tmc_enable_stallguard(stepperJ); break;
#endif
#if K_SENSORLESS
case K_AXIS: stealth_states.k = tmc_enable_stallguard(stepperK); break;
#endif
}
#if ENABLED(SPI_ENDSTOPS)
@ -1479,6 +1490,15 @@ void prepare_line_to_destination() {
#endif
break;
#endif
#if I_SENSORLESS
case I_AXIS: tmc_disable_stallguard(stepperI, enable_stealth.i); break;
#endif
#if J_SENSORLESS
case J_AXIS: tmc_disable_stallguard(stepperJ, enable_stealth.j); break;
#endif
#if K_SENSORLESS
case K_AXIS: tmc_disable_stallguard(stepperK, enable_stealth.k); break;
#endif
}
#if ENABLED(SPI_ENDSTOPS)
@ -1815,8 +1835,12 @@ void prepare_line_to_destination() {
switch (axis) {
default:
case X_AXIS: es = X_ENDSTOP; break;
case Y_AXIS: es = Y_ENDSTOP; break;
case Z_AXIS: es = Z_ENDSTOP; break;
#if HAS_Y_AXIS
case Y_AXIS: es = Y_ENDSTOP; break;
#endif
#if HAS_Z_AXIS
case Z_AXIS: es = Z_ENDSTOP; break;
#endif
#if HAS_I_AXIS
case I_AXIS: es = I_ENDSTOP; break;
#endif