Merge pull request #5169 from thinkyhead/rc_core_inverted

Support for COREYX, COREZX, COREZY
This commit is contained in:
Scott Lahteine 2016-11-28 02:26:41 -06:00 committed by GitHub
commit 092e949b58
29 changed files with 198 additions and 88 deletions

View file

@ -39,20 +39,31 @@
#define Z_CENTER float((Z_MIN_POS + Z_MAX_POS) * 0.5) #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_IS_XY (ENABLED(COREXY) || ENABLED(COREYX))
#define CORE_AXIS_1 A_AXIS // XY from A + B #define CORE_IS_XZ (ENABLED(COREXZ) || ENABLED(COREZX))
#define CORE_AXIS_2 B_AXIS #define CORE_IS_YZ (ENABLED(COREYZ) || ENABLED(COREZY))
#define NORMAL_AXIS Z_AXIS #define IS_CORE (CORE_IS_XY || CORE_IS_XZ || CORE_IS_YZ)
#elif ENABLED(COREXZ) #if IS_CORE
#define CORE_AXIS_1 A_AXIS // XZ from A + C #if CORE_IS_XY
#define CORE_AXIS_2 C_AXIS #define CORE_AXIS_1 A_AXIS
#define NORMAL_AXIS Y_AXIS #define CORE_AXIS_2 B_AXIS
#elif ENABLED(COREYZ) #define NORMAL_AXIS Z_AXIS
#define CORE_AXIS_1 B_AXIS // YZ from B + C #elif CORE_IS_XZ
#define CORE_AXIS_2 C_AXIS #define CORE_AXIS_1 A_AXIS
#define NORMAL_AXIS X_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 #endif
#define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA)) #define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA))

View file

@ -408,9 +408,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -3078,7 +3078,7 @@ inline void gcode_G4() {
SERIAL_ECHOLNPGM("Delta"); SERIAL_ECHOLNPGM("Delta");
#elif IS_SCARA #elif IS_SCARA
SERIAL_ECHOLNPGM("SCARA"); SERIAL_ECHOLNPGM("SCARA");
#elif ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ) #elif IS_CORE
SERIAL_ECHOLNPGM("Core"); SERIAL_ECHOLNPGM("Core");
#else #else
SERIAL_ECHOLNPGM("Cartesian"); SERIAL_ECHOLNPGM("Cartesian");

View file

@ -57,8 +57,8 @@
#error "Thermal Runaway Protection for hotends is now enabled with THERMAL_PROTECTION_HOTENDS." #error "Thermal Runaway Protection for hotends is now enabled with THERMAL_PROTECTION_HOTENDS."
#elif DISABLED(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD) #elif DISABLED(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD)
#error "Thermal Runaway Protection for the bed is now enabled with THERMAL_PROTECTION_BED." #error "Thermal Runaway Protection for the bed is now enabled with THERMAL_PROTECTION_BED."
#elif ENABLED(COREXZ) && ENABLED(Z_LATE_ENABLE) #elif (CORE_IS_XZ || CORE_IS_YZ) && ENABLED(Z_LATE_ENABLE)
#error "Z_LATE_ENABLE can't be used with COREXZ." #error "Z_LATE_ENABLE can't be used with COREXZ, COREZX, COREYZ, or COREZY."
#elif defined(X_HOME_RETRACT_MM) #elif defined(X_HOME_RETRACT_MM)
#error "[XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM." #error "[XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM."
#elif defined(SDCARDDETECTINVERTED) #elif defined(SDCARDDETECTINVERTED)
@ -644,8 +644,23 @@
#else #else
#define COUNT_KIN_7 COUNT_KIN_6 #define COUNT_KIN_7 COUNT_KIN_6
#endif #endif
#if COUNT_KIN_7 > 1 #if ENABLED(COREYX)
#error "Please enable only one of DELTA, MORGAN_SCARA, MAKERARM_SCARA, COREXY, COREXZ, or COREYZ." #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 #endif
/** /**
@ -662,8 +677,8 @@
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
#if EXTRUDERS == 1 #if EXTRUDERS == 1
#error "DUAL_X_CARRIAGE requires 2 (or more) extruders." #error "DUAL_X_CARRIAGE requires 2 (or more) extruders."
#elif ENABLED(COREXY) || ENABLED(COREXZ) #elif CORE_IS_XY || CORE_IS_XZ
#error "DUAL_X_CARRIAGE cannot be used with COREXY or COREXZ." #error "DUAL_X_CARRIAGE cannot be used with COREXY, COREYX, COREXZ, or COREZX."
#elif !HAS_X2_ENABLE || !HAS_X2_STEP || !HAS_X2_DIR #elif !HAS_X2_ENABLE || !HAS_X2_STEP || !HAS_X2_DIR
#error "DUAL_X_CARRIAGE requires X2 stepper pins to be defined." #error "DUAL_X_CARRIAGE requires X2 stepper pins to be defined."
#elif !HAS_X_MAX #elif !HAS_X_MAX

View file

@ -268,7 +268,7 @@ void Endstops::update() {
#endif #endif
#if ENABLED(COREXY) || ENABLED(COREXZ) #if CORE_IS_XY || CORE_IS_XZ
// Head direction in -X axis for CoreXY and CoreXZ bots. // Head direction in -X axis for CoreXY and CoreXZ bots.
// If DeltaA == -DeltaB, the movement is only in Y or Z axis // 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))) { 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 #endif
} }
} }
#if ENABLED(COREXY) || ENABLED(COREXZ) #if CORE_IS_XY || CORE_IS_XZ
} }
#endif #endif
#if ENABLED(COREXY) || ENABLED(COREYZ) #if CORE_IS_XY || CORE_IS_YZ
// Head direction in -Y axis for CoreXY / CoreYZ bots. // Head direction in -Y axis for CoreXY / CoreYZ bots.
// If DeltaA == DeltaB, the movement is only in X or Y axis // 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))) { 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); UPDATE_ENDSTOP(Y, MAX);
#endif #endif
} }
#if ENABLED(COREXY) || ENABLED(COREYZ) #if CORE_IS_XY || CORE_IS_YZ
} }
#endif #endif
#if ENABLED(COREXZ) || ENABLED(COREYZ) #if CORE_IS_XZ || CORE_IS_YZ
// Head direction in -Z axis for CoreXZ or CoreYZ bots. // Head direction in -Z axis for CoreXZ or CoreYZ bots.
// If DeltaA == DeltaB, the movement is only in X or Y axis // 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))) { 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_MIN_PROBE_PIN...
#endif // Z_MAX_PIN #endif // Z_MAX_PIN
} }
#if ENABLED(COREXZ) #if CORE_IS_XZ || CORE_IS_YZ
} }
#endif #endif

View file

@ -408,9 +408,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -390,9 +390,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -390,9 +390,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -400,9 +400,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -402,9 +402,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -438,9 +438,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -408,9 +408,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -408,9 +408,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -408,9 +408,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -405,9 +405,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -423,9 +423,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -429,9 +429,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -400,9 +400,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -408,9 +408,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -408,9 +408,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
//=========================================================================== //===========================================================================
//============================== Delta Settings ============================= //============================== Delta Settings =============================

View file

@ -408,9 +408,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
//=========================================================================== //===========================================================================
//============================== Delta Settings ============================= //============================== Delta Settings =============================

View file

@ -408,9 +408,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
//=========================================================================== //===========================================================================
//============================== Delta Settings ============================= //============================== Delta Settings =============================

View file

@ -395,9 +395,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
//=========================================================================== //===========================================================================
//============================== Delta Settings ============================= //============================== Delta Settings =============================

View file

@ -406,9 +406,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
//=========================================================================== //===========================================================================
//============================== Delta Settings ============================= //============================== Delta Settings =============================

View file

@ -411,9 +411,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

View file

@ -398,9 +398,13 @@
// @section machine // @section machine
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed
//#define COREXY //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX
//#define COREZX
//#define COREZY
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
#define CONFIG_STEPPERS_TOSHIBA #define CONFIG_STEPPERS_TOSHIBA

View file

@ -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 // Compute direction bit-mask for this block
uint8_t dm = 0; uint8_t dm = 0;
#if ENABLED(COREXY) #if CORE_IS_XY
if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis 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 (db < 0) SBI(dm, Y_HEAD); // ...and Y
if (dc < 0) SBI(dm, Z_AXIS); if (dc < 0) SBI(dm, Z_AXIS);
if (da + db < 0) SBI(dm, A_AXIS); // Motor A direction if (da + db < 0) SBI(dm, A_AXIS); // Motor A direction
if (da - db < 0) SBI(dm, B_AXIS); // Motor B direction if (CORESIGN(da - db) < 0) SBI(dm, B_AXIS); // Motor B direction
#elif ENABLED(COREXZ) #elif CORE_IS_XZ
if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis
if (db < 0) SBI(dm, Y_AXIS); if (db < 0) SBI(dm, Y_AXIS);
if (dc < 0) SBI(dm, Z_HEAD); // ...and Z 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, A_AXIS); // Motor A direction
if (da - dc < 0) SBI(dm, C_AXIS); // Motor C direction if (CORESIGN(da - dc) < 0) SBI(dm, C_AXIS); // Motor C direction
#elif ENABLED(COREYZ) #elif CORE_IS_YZ
if (da < 0) SBI(dm, X_AXIS); if (da < 0) SBI(dm, X_AXIS);
if (db < 0) SBI(dm, Y_HEAD); // Save the real Extruder (head) direction in Y 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 (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, B_AXIS); // Motor B direction
if (db - dc < 0) SBI(dm, C_AXIS); // Motor C direction if (CORESIGN(db - dc) < 0) SBI(dm, C_AXIS); // Motor C direction
#else #else
if (da < 0) SBI(dm, X_AXIS); if (da < 0) SBI(dm, X_AXIS);
if (db < 0) SBI(dm, Y_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; block->direction_bits = dm;
// Number of steps for each axis // Number of steps for each axis
#if ENABLED(COREXY) // See http://www.corexy.com/theory.html
// corexy planning #if CORE_IS_XY
// these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
block->steps[A_AXIS] = labs(da + db); block->steps[A_AXIS] = labs(da + db);
block->steps[B_AXIS] = labs(da - db); block->steps[B_AXIS] = labs(da - db);
block->steps[Z_AXIS] = labs(dc); block->steps[Z_AXIS] = labs(dc);
#elif ENABLED(COREXZ) #elif CORE_IS_XZ
// corexz planning
block->steps[A_AXIS] = labs(da + dc); block->steps[A_AXIS] = labs(da + dc);
block->steps[Y_AXIS] = labs(db); block->steps[Y_AXIS] = labs(db);
block->steps[C_AXIS] = labs(da - dc); block->steps[C_AXIS] = labs(da - dc);
#elif ENABLED(COREYZ) #elif CORE_IS_YZ
// coreyz planning
block->steps[X_AXIS] = labs(da); block->steps[X_AXIS] = labs(da);
block->steps[B_AXIS] = labs(db + dc); block->steps[B_AXIS] = labs(db + dc);
block->steps[C_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; block->active_extruder = extruder;
//enable active axes //enable active axes
#if ENABLED(COREXY) #if CORE_IS_XY
if (block->steps[A_AXIS] || block->steps[B_AXIS]) { if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
enable_x(); enable_x();
enable_y(); 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 DISABLED(Z_LATE_ENABLE)
if (block->steps[Z_AXIS]) enable_z(); if (block->steps[Z_AXIS]) enable_z();
#endif #endif
#elif ENABLED(COREXZ) #elif CORE_IS_XZ
if (block->steps[A_AXIS] || block->steps[C_AXIS]) { if (block->steps[A_AXIS] || block->steps[C_AXIS]) {
enable_x(); enable_x();
enable_z(); enable_z();
} }
if (block->steps[Y_AXIS]) enable_y(); if (block->steps[Y_AXIS]) enable_y();
#elif ENABLED(COREYZ) #elif CORE_IS_YZ
if (block->steps[B_AXIS] || block->steps[C_AXIS]) { if (block->steps[B_AXIS] || block->steps[C_AXIS]) {
enable_y(); enable_y();
enable_z(); 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. * 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. * 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]; float delta_mm[7];
#if ENABLED(COREXY) #if CORE_IS_XY
delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS]; delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS];
delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS]; delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS];
delta_mm[Z_AXIS] = dc * steps_to_mm[Z_AXIS]; delta_mm[Z_AXIS] = dc * steps_to_mm[Z_AXIS];
delta_mm[A_AXIS] = (da + db) * steps_to_mm[A_AXIS]; delta_mm[A_AXIS] = (da + db) * steps_to_mm[A_AXIS];
delta_mm[B_AXIS] = (da - db) * steps_to_mm[B_AXIS]; delta_mm[B_AXIS] = CORESIGN(da - db) * steps_to_mm[B_AXIS];
#elif ENABLED(COREXZ) #elif CORE_IS_XZ
delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS]; delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS];
delta_mm[Y_AXIS] = db * steps_to_mm[Y_AXIS]; delta_mm[Y_AXIS] = db * steps_to_mm[Y_AXIS];
delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS]; delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS];
delta_mm[A_AXIS] = (da + dc) * steps_to_mm[A_AXIS]; delta_mm[A_AXIS] = (da + dc) * steps_to_mm[A_AXIS];
delta_mm[C_AXIS] = (da - dc) * steps_to_mm[C_AXIS]; delta_mm[C_AXIS] = CORESIGN(da - dc) * steps_to_mm[C_AXIS];
#elif ENABLED(COREYZ) #elif CORE_IS_YZ
delta_mm[X_AXIS] = da * steps_to_mm[X_AXIS]; delta_mm[X_AXIS] = da * steps_to_mm[X_AXIS];
delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS]; delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS];
delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS]; delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS];
delta_mm[B_AXIS] = (db + dc) * steps_to_mm[B_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 #endif
#else #else
float delta_mm[4]; float delta_mm[4];
@ -949,11 +946,11 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
} }
else { else {
block->millimeters = sqrt( 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]) 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]) 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]) sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_HEAD])
#else #else
sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS]) sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS])

View file

@ -991,22 +991,22 @@ void Stepper::set_position(const long &a, const long &b, const long &c, const lo
CRITICAL_SECTION_START; CRITICAL_SECTION_START;
#if ENABLED(COREXY) #if CORE_IS_XY
// corexy positioning // corexy positioning
// these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html // 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[A_AXIS] = a + b;
count_position[B_AXIS] = a - b; count_position[B_AXIS] = CORESIGN(a - b);
count_position[Z_AXIS] = c; count_position[Z_AXIS] = c;
#elif ENABLED(COREXZ) #elif CORE_IS_XZ
// corexz planning // corexz planning
count_position[A_AXIS] = a + c; count_position[A_AXIS] = a + c;
count_position[Y_AXIS] = b; count_position[Y_AXIS] = b;
count_position[C_AXIS] = a - c; count_position[C_AXIS] = CORESIGN(a - c);
#elif ENABLED(COREYZ) #elif CORE_IS_YZ
// coreyz planning // coreyz planning
count_position[X_AXIS] = a; count_position[X_AXIS] = a;
count_position[B_AXIS] = b + c; count_position[B_AXIS] = b + c;
count_position[C_AXIS] = b - c; count_position[C_AXIS] = CORESIGN(b - c);
#else #else
// default non-h-bot planning // default non-h-bot planning
count_position[X_AXIS] = a; count_position[X_AXIS] = a;
@ -1046,16 +1046,17 @@ long Stepper::position(AxisEnum axis) {
*/ */
float Stepper::get_axis_position_mm(AxisEnum axis) { float Stepper::get_axis_position_mm(AxisEnum axis) {
float axis_steps; float axis_steps;
#if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ) #if IS_CORE
// Requesting one of the "core" axes? // Requesting one of the "core" axes?
if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) { if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) {
CRITICAL_SECTION_START; 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 -> (a1+a1)/2 -> a1
// ((a1+a2)-(a1-a2))/2 -> (a1+a2-a1+a2)/2 -> (a2+a2)/2 -> a2 // ((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 else
axis_steps = position(axis); axis_steps = position(axis);
@ -1083,14 +1084,12 @@ void Stepper::quick_stop() {
void Stepper::endstop_triggered(AxisEnum axis) { void Stepper::endstop_triggered(AxisEnum axis) {
#if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ) #if IS_CORE
float axis_pos = count_position[axis]; endstops_trigsteps[axis] = 0.5f * (
if (axis == CORE_AXIS_1) axis == CORE_AXIS_2 ? CORESIGN(count_position[CORE_AXIS_1] - count_position[CORE_AXIS_2])
axis_pos = (axis_pos + count_position[CORE_AXIS_2]) * 0.5; : count_position[CORE_AXIS_1] + count_position[CORE_AXIS_2]
else if (axis == CORE_AXIS_2) );
axis_pos = (count_position[CORE_AXIS_1] - axis_pos) * 0.5;
endstops_trigsteps[axis] = axis_pos;
#else // !COREXY && !COREXZ && !COREYZ #else // !COREXY && !COREXZ && !COREYZ
@ -1108,21 +1107,21 @@ void Stepper::report_positions() {
zpos = count_position[Z_AXIS]; zpos = count_position[Z_AXIS];
CRITICAL_SECTION_END; CRITICAL_SECTION_END;
#if ENABLED(COREXY) || ENABLED(COREXZ) || IS_SCARA #if CORE_IS_XY || CORE_IS_XZ || IS_SCARA
SERIAL_PROTOCOLPGM(MSG_COUNT_A); SERIAL_PROTOCOLPGM(MSG_COUNT_A);
#else #else
SERIAL_PROTOCOLPGM(MSG_COUNT_X); SERIAL_PROTOCOLPGM(MSG_COUNT_X);
#endif #endif
SERIAL_PROTOCOL(xpos); SERIAL_PROTOCOL(xpos);
#if ENABLED(COREXY) || ENABLED(COREYZ) || IS_SCARA #if CORE_IS_XY || CORE_IS_YZ || IS_SCARA
SERIAL_PROTOCOLPGM(" B:"); SERIAL_PROTOCOLPGM(" B:");
#else #else
SERIAL_PROTOCOLPGM(" Y:"); SERIAL_PROTOCOLPGM(" Y:");
#endif #endif
SERIAL_PROTOCOL(ypos); SERIAL_PROTOCOL(ypos);
#if ENABLED(COREXZ) || ENABLED(COREYZ) #if CORE_IS_XZ || CORE_IS_YZ
SERIAL_PROTOCOLPGM(" C:"); SERIAL_PROTOCOLPGM(" C:");
#else #else
SERIAL_PROTOCOLPGM(" Z:"); SERIAL_PROTOCOLPGM(" Z:");

View file

@ -385,7 +385,7 @@ class Temperature {
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
static void babystep_axis(const AxisEnum axis, const int distance) { static void babystep_axis(const AxisEnum axis, const int distance) {
#if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ) #if IS_CORE
#if ENABLED(BABYSTEP_XY) #if ENABLED(BABYSTEP_XY)
switch (axis) { switch (axis) {
case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ
@ -393,17 +393,17 @@ class Temperature {
babystepsTodo[CORE_AXIS_2] += distance * 2; babystepsTodo[CORE_AXIS_2] += distance * 2;
break; break;
case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ
babystepsTodo[CORE_AXIS_1] += distance * 2; babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2);
babystepsTodo[CORE_AXIS_2] -= distance * 2; babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2);
break; break;
case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ
babystepsTodo[NORMAL_AXIS] += distance; babystepsTodo[NORMAL_AXIS] += distance;
break; break;
} }
#elif ENABLED(COREXZ) || ENABLED(COREYZ) #elif CORE_IS_XZ || CORE_IS_YZ
// Only Z stepping needs to be handled here // Only Z stepping needs to be handled here
babystepsTodo[CORE_AXIS_1] += distance * 2; babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2);
babystepsTodo[CORE_AXIS_2] -= distance * 2; babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2);
#else #else
babystepsTodo[Z_AXIS] += distance; babystepsTodo[Z_AXIS] += distance;
#endif #endif