Merge pull request #5169 from thinkyhead/rc_core_inverted
Support for COREYX, COREZX, COREZY
This commit is contained in:
commit
092e949b58
29 changed files with 198 additions and 88 deletions
|
@ -39,20 +39,31 @@
|
|||
#define Z_CENTER float((Z_MIN_POS + Z_MAX_POS) * 0.5)
|
||||
|
||||
/**
|
||||
* CoreXY and CoreXZ
|
||||
* CoreXY, CoreXZ, and CoreYZ - and their reverse
|
||||
*/
|
||||
#if ENABLED(COREXY)
|
||||
#define CORE_AXIS_1 A_AXIS // XY from A + B
|
||||
#define CORE_AXIS_2 B_AXIS
|
||||
#define NORMAL_AXIS Z_AXIS
|
||||
#elif ENABLED(COREXZ)
|
||||
#define CORE_AXIS_1 A_AXIS // XZ from A + C
|
||||
#define CORE_AXIS_2 C_AXIS
|
||||
#define NORMAL_AXIS Y_AXIS
|
||||
#elif ENABLED(COREYZ)
|
||||
#define CORE_AXIS_1 B_AXIS // YZ from B + C
|
||||
#define CORE_AXIS_2 C_AXIS
|
||||
#define NORMAL_AXIS X_AXIS
|
||||
#define CORE_IS_XY (ENABLED(COREXY) || ENABLED(COREYX))
|
||||
#define CORE_IS_XZ (ENABLED(COREXZ) || ENABLED(COREZX))
|
||||
#define CORE_IS_YZ (ENABLED(COREYZ) || ENABLED(COREZY))
|
||||
#define IS_CORE (CORE_IS_XY || CORE_IS_XZ || CORE_IS_YZ)
|
||||
#if IS_CORE
|
||||
#if CORE_IS_XY
|
||||
#define CORE_AXIS_1 A_AXIS
|
||||
#define CORE_AXIS_2 B_AXIS
|
||||
#define NORMAL_AXIS Z_AXIS
|
||||
#elif CORE_IS_XZ
|
||||
#define CORE_AXIS_1 A_AXIS
|
||||
#define NORMAL_AXIS Y_AXIS
|
||||
#define CORE_AXIS_2 C_AXIS
|
||||
#elif CORE_IS_YZ
|
||||
#define NORMAL_AXIS X_AXIS
|
||||
#define CORE_AXIS_1 B_AXIS
|
||||
#define CORE_AXIS_2 C_AXIS
|
||||
#endif
|
||||
#if (ENABLED(COREYX) || ENABLED(COREZX) || ENABLED(COREZY))
|
||||
#define CORESIGN(n) (-(n))
|
||||
#else
|
||||
#define CORESIGN(n) (n)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA))
|
||||
|
|
|
@ -408,9 +408,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -3078,7 +3078,7 @@ inline void gcode_G4() {
|
|||
SERIAL_ECHOLNPGM("Delta");
|
||||
#elif IS_SCARA
|
||||
SERIAL_ECHOLNPGM("SCARA");
|
||||
#elif ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
|
||||
#elif IS_CORE
|
||||
SERIAL_ECHOLNPGM("Core");
|
||||
#else
|
||||
SERIAL_ECHOLNPGM("Cartesian");
|
||||
|
|
|
@ -57,8 +57,8 @@
|
|||
#error "Thermal Runaway Protection for hotends is now enabled with THERMAL_PROTECTION_HOTENDS."
|
||||
#elif DISABLED(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD)
|
||||
#error "Thermal Runaway Protection for the bed is now enabled with THERMAL_PROTECTION_BED."
|
||||
#elif ENABLED(COREXZ) && ENABLED(Z_LATE_ENABLE)
|
||||
#error "Z_LATE_ENABLE can't be used with COREXZ."
|
||||
#elif (CORE_IS_XZ || CORE_IS_YZ) && ENABLED(Z_LATE_ENABLE)
|
||||
#error "Z_LATE_ENABLE can't be used with COREXZ, COREZX, COREYZ, or COREZY."
|
||||
#elif defined(X_HOME_RETRACT_MM)
|
||||
#error "[XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM."
|
||||
#elif defined(SDCARDDETECTINVERTED)
|
||||
|
@ -644,8 +644,23 @@
|
|||
#else
|
||||
#define COUNT_KIN_7 COUNT_KIN_6
|
||||
#endif
|
||||
#if COUNT_KIN_7 > 1
|
||||
#error "Please enable only one of DELTA, MORGAN_SCARA, MAKERARM_SCARA, COREXY, COREXZ, or COREYZ."
|
||||
#if ENABLED(COREYX)
|
||||
#define COUNT_KIN_8 INCREMENT(COUNT_KIN_7)
|
||||
#else
|
||||
#define COUNT_KIN_8 COUNT_KIN_7
|
||||
#endif
|
||||
#if ENABLED(COREZX)
|
||||
#define COUNT_KIN_9 INCREMENT(COUNT_KIN_8)
|
||||
#else
|
||||
#define COUNT_KIN_9 COUNT_KIN_8
|
||||
#endif
|
||||
#if ENABLED(COREZY)
|
||||
#define COUNT_KIN_10 INCREMENT(COUNT_KIN_9)
|
||||
#else
|
||||
#define COUNT_KIN_10 COUNT_KIN_9
|
||||
#endif
|
||||
#if COUNT_KIN_10 > 1
|
||||
#error "Please enable only one of DELTA, MORGAN_SCARA, MAKERARM_SCARA, COREXY, COREYX, COREXZ, COREZX, COREYZ, or COREZY."
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -662,8 +677,8 @@
|
|||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
#if EXTRUDERS == 1
|
||||
#error "DUAL_X_CARRIAGE requires 2 (or more) extruders."
|
||||
#elif ENABLED(COREXY) || ENABLED(COREXZ)
|
||||
#error "DUAL_X_CARRIAGE cannot be used with COREXY or COREXZ."
|
||||
#elif CORE_IS_XY || CORE_IS_XZ
|
||||
#error "DUAL_X_CARRIAGE cannot be used with COREXY, COREYX, COREXZ, or COREZX."
|
||||
#elif !HAS_X2_ENABLE || !HAS_X2_STEP || !HAS_X2_DIR
|
||||
#error "DUAL_X_CARRIAGE requires X2 stepper pins to be defined."
|
||||
#elif !HAS_X_MAX
|
||||
|
|
|
@ -268,7 +268,7 @@ void Endstops::update() {
|
|||
|
||||
#endif
|
||||
|
||||
#if ENABLED(COREXY) || ENABLED(COREXZ)
|
||||
#if CORE_IS_XY || CORE_IS_XZ
|
||||
// Head direction in -X axis for CoreXY and CoreXZ bots.
|
||||
// If DeltaA == -DeltaB, the movement is only in Y or Z axis
|
||||
if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) == stepper.motor_direction(CORE_AXIS_2))) {
|
||||
|
@ -298,11 +298,11 @@ void Endstops::update() {
|
|||
#endif
|
||||
}
|
||||
}
|
||||
#if ENABLED(COREXY) || ENABLED(COREXZ)
|
||||
#if CORE_IS_XY || CORE_IS_XZ
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(COREXY) || ENABLED(COREYZ)
|
||||
#if CORE_IS_XY || CORE_IS_YZ
|
||||
// Head direction in -Y axis for CoreXY / CoreYZ bots.
|
||||
// If DeltaA == DeltaB, the movement is only in X or Y axis
|
||||
if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) != stepper.motor_direction(CORE_AXIS_2))) {
|
||||
|
@ -320,11 +320,11 @@ void Endstops::update() {
|
|||
UPDATE_ENDSTOP(Y, MAX);
|
||||
#endif
|
||||
}
|
||||
#if ENABLED(COREXY) || ENABLED(COREYZ)
|
||||
#if CORE_IS_XY || CORE_IS_YZ
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(COREXZ) || ENABLED(COREYZ)
|
||||
#if CORE_IS_XZ || CORE_IS_YZ
|
||||
// Head direction in -Z axis for CoreXZ or CoreYZ bots.
|
||||
// If DeltaA == DeltaB, the movement is only in X or Y axis
|
||||
if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) != stepper.motor_direction(CORE_AXIS_2))) {
|
||||
|
@ -390,7 +390,7 @@ void Endstops::update() {
|
|||
#endif // !Z_MIN_PROBE_PIN...
|
||||
#endif // Z_MAX_PIN
|
||||
}
|
||||
#if ENABLED(COREXZ)
|
||||
#if CORE_IS_XZ || CORE_IS_YZ
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -408,9 +408,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -390,9 +390,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -390,9 +390,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -400,9 +400,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -402,9 +402,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -438,9 +438,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -408,9 +408,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -408,9 +408,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -408,9 +408,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -405,9 +405,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -423,9 +423,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -429,9 +429,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -400,9 +400,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -408,9 +408,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -408,9 +408,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
//===========================================================================
|
||||
//============================== Delta Settings =============================
|
||||
|
|
|
@ -408,9 +408,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
//===========================================================================
|
||||
//============================== Delta Settings =============================
|
||||
|
|
|
@ -408,9 +408,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
//===========================================================================
|
||||
//============================== Delta Settings =============================
|
||||
|
|
|
@ -395,9 +395,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
//===========================================================================
|
||||
//============================== Delta Settings =============================
|
||||
|
|
|
@ -406,9 +406,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
//===========================================================================
|
||||
//============================== Delta Settings =============================
|
||||
|
|
|
@ -411,9 +411,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
//#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -398,9 +398,13 @@
|
|||
// @section machine
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
//#define COREZX
|
||||
//#define COREZY
|
||||
|
||||
// Enable this option for Toshiba steppers
|
||||
#define CONFIG_STEPPERS_TOSHIBA
|
||||
|
|
|
@ -712,24 +712,24 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
|||
|
||||
// Compute direction bit-mask for this block
|
||||
uint8_t dm = 0;
|
||||
#if ENABLED(COREXY)
|
||||
if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis
|
||||
if (db < 0) SBI(dm, Y_HEAD); // ...and Y
|
||||
#if CORE_IS_XY
|
||||
if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis
|
||||
if (db < 0) SBI(dm, Y_HEAD); // ...and Y
|
||||
if (dc < 0) SBI(dm, Z_AXIS);
|
||||
if (da + db < 0) SBI(dm, A_AXIS); // Motor A direction
|
||||
if (da - db < 0) SBI(dm, B_AXIS); // Motor B direction
|
||||
#elif ENABLED(COREXZ)
|
||||
if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis
|
||||
if (da + db < 0) SBI(dm, A_AXIS); // Motor A direction
|
||||
if (CORESIGN(da - db) < 0) SBI(dm, B_AXIS); // Motor B direction
|
||||
#elif CORE_IS_XZ
|
||||
if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis
|
||||
if (db < 0) SBI(dm, Y_AXIS);
|
||||
if (dc < 0) SBI(dm, Z_HEAD); // ...and Z
|
||||
if (da + dc < 0) SBI(dm, A_AXIS); // Motor A direction
|
||||
if (da - dc < 0) SBI(dm, C_AXIS); // Motor C direction
|
||||
#elif ENABLED(COREYZ)
|
||||
if (dc < 0) SBI(dm, Z_HEAD); // ...and Z
|
||||
if (da + dc < 0) SBI(dm, A_AXIS); // Motor A direction
|
||||
if (CORESIGN(da - dc) < 0) SBI(dm, C_AXIS); // Motor C direction
|
||||
#elif CORE_IS_YZ
|
||||
if (da < 0) SBI(dm, X_AXIS);
|
||||
if (db < 0) SBI(dm, Y_HEAD); // Save the real Extruder (head) direction in Y Axis
|
||||
if (dc < 0) SBI(dm, Z_HEAD); // ...and Z
|
||||
if (db + dc < 0) SBI(dm, B_AXIS); // Motor B direction
|
||||
if (db - dc < 0) SBI(dm, C_AXIS); // Motor C direction
|
||||
if (db < 0) SBI(dm, Y_HEAD); // Save the real Extruder (head) direction in Y Axis
|
||||
if (dc < 0) SBI(dm, Z_HEAD); // ...and Z
|
||||
if (db + dc < 0) SBI(dm, B_AXIS); // Motor B direction
|
||||
if (CORESIGN(db - dc) < 0) SBI(dm, C_AXIS); // Motor C direction
|
||||
#else
|
||||
if (da < 0) SBI(dm, X_AXIS);
|
||||
if (db < 0) SBI(dm, Y_AXIS);
|
||||
|
@ -757,19 +757,16 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
|||
block->direction_bits = dm;
|
||||
|
||||
// Number of steps for each axis
|
||||
#if ENABLED(COREXY)
|
||||
// corexy planning
|
||||
// these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
|
||||
// See http://www.corexy.com/theory.html
|
||||
#if CORE_IS_XY
|
||||
block->steps[A_AXIS] = labs(da + db);
|
||||
block->steps[B_AXIS] = labs(da - db);
|
||||
block->steps[Z_AXIS] = labs(dc);
|
||||
#elif ENABLED(COREXZ)
|
||||
// corexz planning
|
||||
#elif CORE_IS_XZ
|
||||
block->steps[A_AXIS] = labs(da + dc);
|
||||
block->steps[Y_AXIS] = labs(db);
|
||||
block->steps[C_AXIS] = labs(da - dc);
|
||||
#elif ENABLED(COREYZ)
|
||||
// coreyz planning
|
||||
#elif CORE_IS_YZ
|
||||
block->steps[X_AXIS] = labs(da);
|
||||
block->steps[B_AXIS] = labs(db + dc);
|
||||
block->steps[C_AXIS] = labs(db - dc);
|
||||
|
@ -804,7 +801,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
|||
block->active_extruder = extruder;
|
||||
|
||||
//enable active axes
|
||||
#if ENABLED(COREXY)
|
||||
#if CORE_IS_XY
|
||||
if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
|
||||
enable_x();
|
||||
enable_y();
|
||||
|
@ -812,13 +809,13 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
|||
#if DISABLED(Z_LATE_ENABLE)
|
||||
if (block->steps[Z_AXIS]) enable_z();
|
||||
#endif
|
||||
#elif ENABLED(COREXZ)
|
||||
#elif CORE_IS_XZ
|
||||
if (block->steps[A_AXIS] || block->steps[C_AXIS]) {
|
||||
enable_x();
|
||||
enable_z();
|
||||
}
|
||||
if (block->steps[Y_AXIS]) enable_y();
|
||||
#elif ENABLED(COREYZ)
|
||||
#elif CORE_IS_YZ
|
||||
if (block->steps[B_AXIS] || block->steps[C_AXIS]) {
|
||||
enable_y();
|
||||
enable_z();
|
||||
|
@ -915,26 +912,26 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
|||
* So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
|
||||
* Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
|
||||
*/
|
||||
#if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
|
||||
#if IS_CORE
|
||||
float delta_mm[7];
|
||||
#if ENABLED(COREXY)
|
||||
#if CORE_IS_XY
|
||||
delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS];
|
||||
delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS];
|
||||
delta_mm[Z_AXIS] = dc * steps_to_mm[Z_AXIS];
|
||||
delta_mm[A_AXIS] = (da + db) * steps_to_mm[A_AXIS];
|
||||
delta_mm[B_AXIS] = (da - db) * steps_to_mm[B_AXIS];
|
||||
#elif ENABLED(COREXZ)
|
||||
delta_mm[B_AXIS] = CORESIGN(da - db) * steps_to_mm[B_AXIS];
|
||||
#elif CORE_IS_XZ
|
||||
delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS];
|
||||
delta_mm[Y_AXIS] = db * steps_to_mm[Y_AXIS];
|
||||
delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS];
|
||||
delta_mm[A_AXIS] = (da + dc) * steps_to_mm[A_AXIS];
|
||||
delta_mm[C_AXIS] = (da - dc) * steps_to_mm[C_AXIS];
|
||||
#elif ENABLED(COREYZ)
|
||||
delta_mm[C_AXIS] = CORESIGN(da - dc) * steps_to_mm[C_AXIS];
|
||||
#elif CORE_IS_YZ
|
||||
delta_mm[X_AXIS] = da * steps_to_mm[X_AXIS];
|
||||
delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS];
|
||||
delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS];
|
||||
delta_mm[B_AXIS] = (db + dc) * steps_to_mm[B_AXIS];
|
||||
delta_mm[C_AXIS] = (db - dc) * steps_to_mm[C_AXIS];
|
||||
delta_mm[C_AXIS] = CORESIGN(db - dc) * steps_to_mm[C_AXIS];
|
||||
#endif
|
||||
#else
|
||||
float delta_mm[4];
|
||||
|
@ -949,11 +946,11 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
|||
}
|
||||
else {
|
||||
block->millimeters = sqrt(
|
||||
#if ENABLED(COREXY)
|
||||
#if CORE_IS_XY
|
||||
sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_AXIS])
|
||||
#elif ENABLED(COREXZ)
|
||||
#elif CORE_IS_XZ
|
||||
sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_HEAD])
|
||||
#elif ENABLED(COREYZ)
|
||||
#elif CORE_IS_YZ
|
||||
sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_HEAD])
|
||||
#else
|
||||
sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS])
|
||||
|
|
|
@ -991,22 +991,22 @@ void Stepper::set_position(const long &a, const long &b, const long &c, const lo
|
|||
|
||||
CRITICAL_SECTION_START;
|
||||
|
||||
#if ENABLED(COREXY)
|
||||
#if CORE_IS_XY
|
||||
// corexy positioning
|
||||
// these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
|
||||
count_position[A_AXIS] = a + b;
|
||||
count_position[B_AXIS] = a - b;
|
||||
count_position[B_AXIS] = CORESIGN(a - b);
|
||||
count_position[Z_AXIS] = c;
|
||||
#elif ENABLED(COREXZ)
|
||||
#elif CORE_IS_XZ
|
||||
// corexz planning
|
||||
count_position[A_AXIS] = a + c;
|
||||
count_position[Y_AXIS] = b;
|
||||
count_position[C_AXIS] = a - c;
|
||||
#elif ENABLED(COREYZ)
|
||||
count_position[C_AXIS] = CORESIGN(a - c);
|
||||
#elif CORE_IS_YZ
|
||||
// coreyz planning
|
||||
count_position[X_AXIS] = a;
|
||||
count_position[B_AXIS] = b + c;
|
||||
count_position[C_AXIS] = b - c;
|
||||
count_position[C_AXIS] = CORESIGN(b - c);
|
||||
#else
|
||||
// default non-h-bot planning
|
||||
count_position[X_AXIS] = a;
|
||||
|
@ -1046,16 +1046,17 @@ long Stepper::position(AxisEnum axis) {
|
|||
*/
|
||||
float Stepper::get_axis_position_mm(AxisEnum axis) {
|
||||
float axis_steps;
|
||||
#if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
|
||||
#if IS_CORE
|
||||
// Requesting one of the "core" axes?
|
||||
if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) {
|
||||
CRITICAL_SECTION_START;
|
||||
long pos1 = count_position[CORE_AXIS_1],
|
||||
pos2 = count_position[CORE_AXIS_2];
|
||||
CRITICAL_SECTION_END;
|
||||
// ((a1+a2)+(a1-a2))/2 -> (a1+a2+a1-a2)/2 -> (a1+a1)/2 -> a1
|
||||
// ((a1+a2)-(a1-a2))/2 -> (a1+a2-a1+a2)/2 -> (a2+a2)/2 -> a2
|
||||
axis_steps = (pos1 + ((axis == CORE_AXIS_1) ? pos2 : -pos2)) * 0.5f;
|
||||
axis_steps = 0.5f * (
|
||||
axis == CORE_AXIS_2 ? CORESIGN(count_position[CORE_AXIS_1] - count_position[CORE_AXIS_2])
|
||||
: count_position[CORE_AXIS_1] + count_position[CORE_AXIS_2]
|
||||
);
|
||||
CRITICAL_SECTION_END;
|
||||
}
|
||||
else
|
||||
axis_steps = position(axis);
|
||||
|
@ -1083,14 +1084,12 @@ void Stepper::quick_stop() {
|
|||
|
||||
void Stepper::endstop_triggered(AxisEnum axis) {
|
||||
|
||||
#if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
|
||||
#if IS_CORE
|
||||
|
||||
float axis_pos = count_position[axis];
|
||||
if (axis == CORE_AXIS_1)
|
||||
axis_pos = (axis_pos + count_position[CORE_AXIS_2]) * 0.5;
|
||||
else if (axis == CORE_AXIS_2)
|
||||
axis_pos = (count_position[CORE_AXIS_1] - axis_pos) * 0.5;
|
||||
endstops_trigsteps[axis] = axis_pos;
|
||||
endstops_trigsteps[axis] = 0.5f * (
|
||||
axis == CORE_AXIS_2 ? CORESIGN(count_position[CORE_AXIS_1] - count_position[CORE_AXIS_2])
|
||||
: count_position[CORE_AXIS_1] + count_position[CORE_AXIS_2]
|
||||
);
|
||||
|
||||
#else // !COREXY && !COREXZ && !COREYZ
|
||||
|
||||
|
@ -1108,21 +1107,21 @@ void Stepper::report_positions() {
|
|||
zpos = count_position[Z_AXIS];
|
||||
CRITICAL_SECTION_END;
|
||||
|
||||
#if ENABLED(COREXY) || ENABLED(COREXZ) || IS_SCARA
|
||||
#if CORE_IS_XY || CORE_IS_XZ || IS_SCARA
|
||||
SERIAL_PROTOCOLPGM(MSG_COUNT_A);
|
||||
#else
|
||||
SERIAL_PROTOCOLPGM(MSG_COUNT_X);
|
||||
#endif
|
||||
SERIAL_PROTOCOL(xpos);
|
||||
|
||||
#if ENABLED(COREXY) || ENABLED(COREYZ) || IS_SCARA
|
||||
#if CORE_IS_XY || CORE_IS_YZ || IS_SCARA
|
||||
SERIAL_PROTOCOLPGM(" B:");
|
||||
#else
|
||||
SERIAL_PROTOCOLPGM(" Y:");
|
||||
#endif
|
||||
SERIAL_PROTOCOL(ypos);
|
||||
|
||||
#if ENABLED(COREXZ) || ENABLED(COREYZ)
|
||||
#if CORE_IS_XZ || CORE_IS_YZ
|
||||
SERIAL_PROTOCOLPGM(" C:");
|
||||
#else
|
||||
SERIAL_PROTOCOLPGM(" Z:");
|
||||
|
|
|
@ -385,7 +385,7 @@ class Temperature {
|
|||
#if ENABLED(BABYSTEPPING)
|
||||
|
||||
static void babystep_axis(const AxisEnum axis, const int distance) {
|
||||
#if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
|
||||
#if IS_CORE
|
||||
#if ENABLED(BABYSTEP_XY)
|
||||
switch (axis) {
|
||||
case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ
|
||||
|
@ -393,17 +393,17 @@ class Temperature {
|
|||
babystepsTodo[CORE_AXIS_2] += distance * 2;
|
||||
break;
|
||||
case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ
|
||||
babystepsTodo[CORE_AXIS_1] += distance * 2;
|
||||
babystepsTodo[CORE_AXIS_2] -= distance * 2;
|
||||
babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2);
|
||||
babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2);
|
||||
break;
|
||||
case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ
|
||||
babystepsTodo[NORMAL_AXIS] += distance;
|
||||
break;
|
||||
}
|
||||
#elif ENABLED(COREXZ) || ENABLED(COREYZ)
|
||||
#elif CORE_IS_XZ || CORE_IS_YZ
|
||||
// Only Z stepping needs to be handled here
|
||||
babystepsTodo[CORE_AXIS_1] += distance * 2;
|
||||
babystepsTodo[CORE_AXIS_2] -= distance * 2;
|
||||
babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2);
|
||||
babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2);
|
||||
#else
|
||||
babystepsTodo[Z_AXIS] += distance;
|
||||
#endif
|
||||
|
|
Reference in a new issue