Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Marlin/src/core/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,17 +366,17 @@
#define STR_Z2 STR_C "2"
#define STR_Z3 STR_C "3"
#define STR_Z4 STR_C "4"
#if CORE_IS_XY || CORE_IS_XZ
#if ANY(HAS_REAL_X, IS_SCARA, DELTA)
#define STEPPER_A_NAME 'A'
#else
#define STEPPER_A_NAME 'X'
#endif
#if CORE_IS_XY || CORE_IS_YZ
#if ANY(HAS_REAL_Y, IS_SCARA, DELTA, POLAR)
#define STEPPER_B_NAME 'B'
#else
#define STEPPER_B_NAME 'Y'
#endif
#if CORE_IS_XZ || CORE_IS_YZ
#if ANY(HAS_REAL_Z, DELTA)
#define STEPPER_C_NAME 'C'
#else
#define STEPPER_C_NAME 'Z'
Expand Down
85 changes: 74 additions & 11 deletions Marlin/src/core/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ typedef struct {
//
// - X_AXIS, Y_AXIS, and Z_AXIS should be used for axes in Cartesian space
// - A_AXIS, B_AXIS, and C_AXIS should be used for Steppers, corresponding to XYZ on Cartesians
// - X_HEAD, Y_HEAD, and Z_HEAD should be used for axes on Core kinematics
// - X_REAL, Y_REAL, and Z_REAL should be used for axes on Core kinematics
//
enum AxisEnum : uint8_t {

Expand All @@ -364,8 +364,14 @@ enum AxisEnum : uint8_t {
#undef _EN_ITEM

// Core also keeps toolhead directions
#if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX)
X_HEAD, Y_HEAD, Z_HEAD,
#if HAS_REAL_X
X_REAL,
#endif
#if HAS_REAL_Y
Y_REAL,
#endif
#if HAS_REAL_Z
Z_REAL,
#endif

// Distinct axes, including all E and Core
Expand All @@ -374,6 +380,10 @@ enum AxisEnum : uint8_t {
// Most of the time we refer only to the single E_AXIS
#if HAS_EXTRUDERS
E_AXIS = E0_AXIS,
E_REAL = E_AXIS,
#define _EN_REAL(N) E##N##_REAL = E##N##_AXIS,
REPEAT(EXTRUDERS, _EN_REAL)
#undef _EN_REAL
#endif

// A, B, and C are for DELTA, SCARA, etc.
Expand All @@ -387,6 +397,35 @@ enum AxisEnum : uint8_t {
C_AXIS = Z_AXIS,
#endif

// Aliases to distinguish tool axes from stepper indexes
#if HAS_X_AXIS && !HAS_REAL_X
X_REAL = X_AXIS,
#endif
#if HAS_Y_AXIS && !HAS_REAL_Y
Y_REAL = Y_AXIS,
#endif
#if HAS_Z_AXIS && !HAS_REAL_Z
Z_REAL = Z_AXIS,
#endif
#if HAS_I_AXIS
I_REAL = I_AXIS,
#endif
#if HAS_J_AXIS
J_REAL = J_AXIS,
#endif
#if HAS_K_AXIS
K_REAL = K_AXIS,
#endif
#if HAS_U_AXIS
U_REAL = U_AXIS,
#endif
#if HAS_V_AXIS
V_REAL = V_AXIS,
#endif
#if HAS_W_AXIS
W_REAL = W_AXIS,
#endif

// To refer to all or none
ALL_AXES_ENUM = 0xFE, NO_AXIS_ENUM = 0xFF
};
Expand Down Expand Up @@ -1153,8 +1192,14 @@ class AxisBits {
#define _EN_ITEM(N) bool e##N:1;
REPEAT(EXTRUDERS,_EN_ITEM)
#undef _EN_ITEM
#if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX)
bool rx:1, ry:1, rz:1;
#if HAS_REAL_X
bool rx:1;
#endif
#if HAS_REAL_Y
bool ry:1;
#endif
#if HAS_REAL_Z
bool rz:1;
#endif
};
// Axes X, Y, Z ... E0, E1, E2 ... RX, RY, RZ
Expand All @@ -1165,8 +1210,14 @@ class AxisBits {
#define _EN_ITEM(N) bool E##N:1;
REPEAT(EXTRUDERS,_EN_ITEM)
#undef _EN_ITEM
#if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX)
bool RX:1, RY:1, RZ:1;
#if HAS_REAL_X
bool RX:1;
#endif
#if HAS_REAL_Y
bool RY:1;
#endif
#if HAS_REAL_Z
bool RZ:1;
#endif
};
// a, b, c, e ... ra, rb, rc
Expand All @@ -1177,8 +1228,14 @@ class AxisBits {
REPEAT_S(1,EXTRUDERS,_EN_ITEM)
#undef _EN_ITEM
#endif
#if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX)
bool ra:1, rb:1, rc:1;
#if HAS_REAL_X
bool ra:1;
#endif
#if HAS_REAL_Y
bool rb:1;
#endif
#if HAS_REAL_Z
bool rc:1;
#endif
};
// A, B, C, E ... RA, RB, RC
Expand All @@ -1189,8 +1246,14 @@ class AxisBits {
REPEAT_S(1,EXTRUDERS,_EN_ITEM)
#undef _EN_ITEM
#endif
#if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX)
bool RA:1, RB:1, RC:1;
#if HAS_REAL_X
bool RA:1;
#endif
#if HAS_REAL_Y
bool RB:1;
#endif
#if HAS_REAL_Z
bool RC:1;
#endif
};
};
Expand Down
9 changes: 9 additions & 0 deletions Marlin/src/inc/Conditionals-3-etc.h
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,15 @@
#if ANY(COREYZ, COREZY)
#define CORE_IS_YZ 1
#endif
#if ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
#define HAS_REAL_X 1
#endif
#if ANY(CORE_IS_XY, CORE_IS_YZ, MARKFORGED_YX)
#define HAS_REAL_Y 1
#endif
#if CORE_IS_XZ || CORE_IS_YZ
#define HAS_REAL_Z 1
#endif
#if CORE_IS_XY || CORE_IS_XZ || CORE_IS_YZ
#define IS_CORE 1
#if CORE_IS_XY
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,7 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
#if ENABLED(DUAL_X_CARRIAGE)
#if EXTRUDERS < 2
#error "DUAL_X_CARRIAGE requires 2 (or more) extruders."
#elif ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY, MARKFORGED_YX)
#elif HAS_REAL_X
#error "DUAL_X_CARRIAGE cannot be used with COREXY, COREYX, COREXZ, COREZX, MARKFORGED_YX, or MARKFORGED_XY."
#elif !GOOD_AXIS_PINS(X2)
#error "DUAL_X_CARRIAGE requires X2 stepper pins to be defined."
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ void menu_move() {

editable.state = c.axis_sync_enabled;
EDIT_ITEM(bool, MSG_FTM_AXIS_SYNC, &editable.state, []{
queue.inject(TS(F("M493"), IAXIS_CHAR(MenuItemBase::itemIndex), 'T', int(editable.state)));
queue.inject(TS(F("M493"), IAXIS_CHAR(MenuItemBase::itemIndex), 'H', int(editable.state)));
});

#if ENABLED(FTM_RESONANCE_TEST)
Expand Down
49 changes: 11 additions & 38 deletions Marlin/src/module/endstops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,30 +462,6 @@ void Endstops::update() {
#define X_MIN_TEST() TERN1(DUAL_X_CARRIAGE, stepper.last_moved_extruder == 0) // Check min for the left carriage
#define X_MAX_TEST() TERN1(DUAL_X_CARRIAGE, stepper.last_moved_extruder != 0) // Check max for the right carriage

// Use HEAD for core axes, AXIS for others
#if ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY, MARKFORGED_YX)
#define X_AXIS_HEAD X_HEAD
#else
#define X_AXIS_HEAD X_AXIS
#endif
#if ANY(CORE_IS_XY, CORE_IS_YZ, MARKFORGED_XY, MARKFORGED_YX)
#define Y_AXIS_HEAD Y_HEAD
#else
#define Y_AXIS_HEAD Y_AXIS
#endif
#if CORE_IS_XZ || CORE_IS_YZ
#define Z_AXIS_HEAD Z_HEAD
#else
#define Z_AXIS_HEAD Z_AXIS
#endif

#define I_AXIS_HEAD I_AXIS
#define J_AXIS_HEAD J_AXIS
#define K_AXIS_HEAD K_AXIS
#define U_AXIS_HEAD U_AXIS
#define V_AXIS_HEAD V_AXIS
#define W_AXIS_HEAD W_AXIS

/**
* Check and update endstops
*/
Expand Down Expand Up @@ -680,8 +656,8 @@ void Endstops::update() {
#define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_DUAL_ENDSTOP(Z, MINMAX)
#endif

#define AXIS_IS_MOVING(A) TERN(FT_MOTION, ftMotion, stepper).axis_is_moving(_AXIS(A))
#define AXIS_DIR_REV(A) !TERN(FT_MOTION, ftMotion, stepper).motor_direction(A)
#define AXIS_IS_MOVING(A) TERN(FT_MOTION, ftMotion, stepper).axis_is_moving(A##_REAL)
#define AXIS_DIR_REV(A) !TERN(FT_MOTION, ftMotion, stepper).axis_direction(A##_REAL)

#if ENABLED(G38_PROBE_TARGET)
// For G38 moves check the probe's pin for ALL movement
Expand All @@ -704,8 +680,7 @@ void Endstops::update() {

#if HAS_X_AXIS
if (AXIS_IS_MOVING(X)) {
const AxisEnum x_head = TERN0(FT_MOTION, ftMotion.cfg.active) ? X_AXIS : X_AXIS_HEAD;
if (AXIS_DIR_REV(x_head)) {
if (AXIS_DIR_REV(X)) {
#if HAS_X_MIN_STATE
PROCESS_ENDSTOP_X(MIN);
#if CORE_DIAG(XY, Y, MIN)
Expand Down Expand Up @@ -738,8 +713,7 @@ void Endstops::update() {

#if HAS_Y_AXIS
if (AXIS_IS_MOVING(Y)) {
const AxisEnum y_head = TERN0(FT_MOTION, ftMotion.cfg.active) ? Y_AXIS : Y_AXIS_HEAD;
if (AXIS_DIR_REV(y_head)) {
if (AXIS_DIR_REV(Y)) {
#if HAS_Y_MIN_STATE
PROCESS_ENDSTOP_Y(MIN);
#if CORE_DIAG(XY, X, MIN)
Expand Down Expand Up @@ -772,8 +746,7 @@ void Endstops::update() {

#if HAS_Z_AXIS
if (AXIS_IS_MOVING(Z)) {
const AxisEnum z_head = TERN0(FT_MOTION, ftMotion.cfg.active) ? Z_AXIS : Z_AXIS_HEAD;
if (AXIS_DIR_REV(z_head)) {
if (AXIS_DIR_REV(Z)) {
// Z- : Gantry down, bed up
#if HAS_Z_MIN_STATE
// If the Z_MIN_PIN is being used for the probe there's no
Expand Down Expand Up @@ -820,7 +793,7 @@ void Endstops::update() {

#if HAS_I_AXIS && HAS_I_STATE
if (AXIS_IS_MOVING(I)) {
if (AXIS_DIR_REV(I_AXIS_HEAD)) {
if (AXIS_DIR_REV(I)) {
#if HAS_I_MIN_STATE
PROCESS_ENDSTOP(I, MIN);
#endif
Expand All @@ -835,7 +808,7 @@ void Endstops::update() {

#if HAS_J_AXIS && HAS_J_STATE
if (AXIS_IS_MOVING(J)) {
if (AXIS_DIR_REV(J_AXIS_HEAD)) {
if (AXIS_DIR_REV(J)) {
#if HAS_J_MIN_STATE
PROCESS_ENDSTOP(J, MIN);
#endif
Expand All @@ -850,7 +823,7 @@ void Endstops::update() {

#if HAS_K_AXIS && HAS_K_STATE
if (AXIS_IS_MOVING(K)) {
if (AXIS_DIR_REV(K_AXIS_HEAD)) {
if (AXIS_DIR_REV(K)) {
#if HAS_K_MIN_STATE
PROCESS_ENDSTOP(K, MIN);
#endif
Expand All @@ -865,7 +838,7 @@ void Endstops::update() {

#if HAS_U_AXIS && HAS_U_STATE
if (AXIS_IS_MOVING(U)) {
if (AXIS_DIR_REV(U_AXIS_HEAD)) {
if (AXIS_DIR_REV(U)) {
#if HAS_U_MIN_STATE
PROCESS_ENDSTOP(U, MIN);
#endif
Expand All @@ -880,7 +853,7 @@ void Endstops::update() {

#if HAS_V_AXIS && HAS_V_STATE
if (AXIS_IS_MOVING(V)) {
if (AXIS_DIR_REV(V_AXIS_HEAD)) {
if (AXIS_DIR_REV(V)) {
#if HAS_V_MIN_STATE
PROCESS_ENDSTOP(V, MIN);
#endif
Expand All @@ -895,7 +868,7 @@ void Endstops::update() {

#if HAS_W_AXIS && HAS_W_STATE
if (AXIS_IS_MOVING(W)) {
if (AXIS_DIR_REV(W_AXIS_HEAD)) {
if (AXIS_DIR_REV(W)) {
#if HAS_W_MIN_STATE
PROCESS_ENDSTOP(W, MIN);
#endif
Expand Down
24 changes: 12 additions & 12 deletions Marlin/src/module/ft_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,16 +389,10 @@ bool FTMotion::plan_next_block() {
recovery.info.current_position = current_block->start_position;
#endif

// Some kinematics track axis motion in RX, RY, RZ
#if ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY, MARKFORGED_YX)
stepper.last_direction_bits.rx = current_block->direction_bits.rx;
#endif
#if ANY(CORE_IS_XY, CORE_IS_YZ, MARKFORGED_XY, MARKFORGED_YX)
stepper.last_direction_bits.ry = current_block->direction_bits.ry;
#endif
#if ANY(CORE_IS_XZ, CORE_IS_YZ)
stepper.last_direction_bits.rz = current_block->direction_bits.rz;
#endif
// Some kinematics track axis motion in HX, HY, HZ
TERN_(HAS_REAL_X, stepper.last_direction_bits.rx = current_block->direction_bits.rx);
TERN_(HAS_REAL_Y, stepper.last_direction_bits.ry = current_block->direction_bits.ry);
TERN_(HAS_REAL_Z, stepper.last_direction_bits.rz = current_block->direction_bits.rz);

// Cache the extruder index / axis for this block
#if ANY(HAS_MULTI_EXTRUDER, MIXING_EXTRUDER)
Expand All @@ -411,7 +405,7 @@ bool FTMotion::plan_next_block() {
const float totalLength = current_block->millimeters;

startPos = endPos_prevBlock;
const xyze_pos_t &moveDist = current_block->distance_mm;
const ext_distance_t &moveDist = current_block->ext_distance_mm;
ratio = moveDist / totalLength;

// Plan the trajectory using the trajectory generator
Expand All @@ -422,9 +416,15 @@ bool FTMotion::plan_next_block() {
TERN_(FTM_HAS_LIN_ADVANCE, use_advance_lead = current_block->use_advance_lead);

axis_move_dir = current_block->direction_bits;
#define _SET_MOVE_END(A) moving_axis_flags.A = bool(moveDist.A);

// Set moving flags for axes that have movement in this block
// For CORE kinematics: moveDist.x/.y/.z contain motor distances (a/b/c)
// HEAD movement flags need to be inferred: if either motor moves, the head moves
#define _SET_MOVE_END(A) moving_axis_flags.A = bool(moveDist.A);
LOGICAL_AXIS_MAP(_SET_MOVE_END);
TERN_(HAS_REAL_X, moving_axis_flags.rx = bool(moveDist.real.x));
TERN_(HAS_REAL_Y, moving_axis_flags.ry = bool(moveDist.real.y));
TERN_(HAS_REAL_Z, moving_axis_flags.rz = bool(moveDist.real.z));

// If the endstop is already pressed, endstop interrupts won't invoke
// endstop_triggered and the move will grind. So check here for a
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/module/ft_motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,11 @@ class FTMotion {
static TrajectoryType getTrajectoryType() { return TERN(FTM_POLYS, trajectoryType, TrajectoryType::TRAPEZOIDAL); }
static FSTR_P getTrajectoryName();

FORCE_INLINE static bool axis_is_moving(const AxisEnum axis) {
return cfg.active ? moving_axis_flags[axis] : TERN0(HAS_STANDARD_MOTION, stepper.axis_is_moving(axis));
FORCE_INLINE static bool axis_is_moving(const AxisEnum real) {
return cfg.active ? moving_axis_flags[real] : TERN0(HAS_STANDARD_MOTION, stepper.axis_is_moving(real));
}
FORCE_INLINE static bool motor_direction(const AxisEnum axis) {
return cfg.active ? axis_move_dir[axis] : stepper.last_direction_bits[axis];
FORCE_INLINE static bool axis_direction(const AxisEnum real) {
return cfg.active ? axis_move_dir[real] : stepper.last_direction_bits[real];
}

// A frame of the stepping plan
Expand Down
Loading