Skip to content

Commit

Permalink
🐛 Fix CoreXY plus extra axes
Browse files Browse the repository at this point in the history
See #22490
  • Loading branch information
thinkyhead committed Aug 9, 2021
1 parent ae846c2 commit cc109c1
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
18 changes: 18 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -1383,20 +1383,38 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#if LINEAR_AXES >= 4
#if AXIS4_NAME != 'A' && AXIS4_NAME != 'B' && AXIS4_NAME != 'C' && AXIS4_NAME != 'U' && AXIS4_NAME != 'V' && AXIS4_NAME != 'W'
#error "AXIS4_NAME can only be one of 'A', 'B', 'C', 'U', 'V', or 'W'."
#elif !defined(I_MIN_POS) || !defined(I_MAX_POS)
#error "I_MIN_POS and I_MAX_POS are required with LINEAR_AXES >= 4."
#elif !defined(I_HOME_DIR)
#error "I_HOME_DIR is required with LINEAR_AXES >= 4."
#elif HAS_I_ENABLE && !defined(I_ENABLE_ON)
#error "I_ENABLE_ON is required for your I driver with LINEAR_AXES >= 4."
#endif
#endif
#if LINEAR_AXES >= 5
#if AXIS5_NAME == AXIS4_NAME || AXIS5_NAME == AXIS6_NAME
#error "AXIS5_NAME must be different from AXIS4_NAME and AXIS6_NAME"
#elif AXIS5_NAME != 'A' && AXIS5_NAME != 'B' && AXIS5_NAME != 'C' && AXIS5_NAME != 'U' && AXIS5_NAME != 'V' && AXIS5_NAME != 'W'
#error "AXIS5_NAME can only be one of 'A', 'B', 'C', 'U', 'V', or 'W'."
#elif !defined(J_MIN_POS) || !defined(J_MAX_POS)
#error "J_MIN_POS and J_MAX_POS are required with LINEAR_AXES >= 5."
#elif !defined(J_HOME_DIR)
#error "J_HOME_DIR is required with LINEAR_AXES >= 5."
#elif HAS_J_ENABLE && !defined(J_ENABLE_ON)
#error "J_ENABLE_ON is required for your J driver with LINEAR_AXES >= 5."
#endif
#endif
#if LINEAR_AXES >= 6
#if AXIS6_NAME == AXIS5_NAME || AXIS6_NAME == AXIS4_NAME
#error "AXIS6_NAME must be different from AXIS5_NAME and AXIS4_NAME."
#elif AXIS6_NAME != 'A' && AXIS6_NAME != 'B' && AXIS6_NAME != 'C' && AXIS6_NAME != 'U' && AXIS6_NAME != 'V' && AXIS6_NAME != 'W'
#error "AXIS6_NAME can only be one of 'A', 'B', 'C', 'U', 'V', or 'W'."
#elif !defined(K_MIN_POS) || !defined(K_MAX_POS)
#error "K_MIN_POS and K_MAX_POS are required with LINEAR_AXES >= 6."
#elif !defined(K_HOME_DIR)
#error "K_HOME_DIR is required with LINEAR_AXES >= 6."
#elif HAS_K_ENABLE && !defined(K_ENABLE_ON)
#error "K_ENABLE_ON is required for your K driver with LINEAR_AXES >= 6."
#endif
#endif

Expand Down
33 changes: 32 additions & 1 deletion Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1877,6 +1877,15 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
" A:", target.a, " (", da, " steps)"
" B:", target.b, " (", db, " steps)"
" C:", target.c, " (", dc, " steps)"
#if LINEAR_AXES >= 4
" " AXIS4_STR ":", target.i, " (", di, " steps)"
#endif
#if LINEAR_AXES >= 5
" " AXIS5_STR ":", target.j, " (", dj, " steps)"
#endif
#if LINEAR_AXES >= 6
" " AXIS6_STR ":", target.k, " (", dk, " steps)"
#endif
#if HAS_EXTRUDERS
" E:", target.e, " (", de, " steps)"
#endif
Expand Down Expand Up @@ -1953,6 +1962,19 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
if (dk < 0) SBI(dm, K_AXIS)
);
#endif

#if IS_CORE
#if LINEAR_AXES >= 4
if (di < 0) SBI(dm, I_AXIS);
#endif
#if LINEAR_AXES >= 5
if (dj < 0) SBI(dm, J_AXIS);
#endif
#if LINEAR_AXES >= 6
if (dk < 0) SBI(dm, K_AXIS);
#endif
#endif

#if HAS_EXTRUDERS
if (de < 0) SBI(dm, E_AXIS);
#endif
Expand Down Expand Up @@ -2004,7 +2026,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
*/
struct DistanceMM : abce_float_t {
#if EITHER(IS_CORE, MARKFORGED_XY)
xyz_pos_t head;
struct { float x, y, z; } head;
#endif
} steps_dist_mm;
#if IS_CORE
Expand All @@ -2027,6 +2049,15 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
steps_dist_mm.b = (db + dc) * steps_to_mm[B_AXIS];
steps_dist_mm.c = CORESIGN(db - dc) * steps_to_mm[C_AXIS];
#endif
#if LINEAR_AXES >= 4
steps_dist_mm.i = di * steps_to_mm[I_AXIS];
#endif
#if LINEAR_AXES >= 5
steps_dist_mm.j = dj * steps_to_mm[J_AXIS];
#endif
#if LINEAR_AXES >= 6
steps_dist_mm.k = dk * steps_to_mm[K_AXIS];
#endif
#elif ENABLED(MARKFORGED_XY)
steps_dist_mm.head.x = da * steps_to_mm[A_AXIS];
steps_dist_mm.head.y = db * steps_to_mm[B_AXIS];
Expand Down

0 comments on commit cc109c1

Please sign in to comment.