Merge CORE_XZ (PR#2300)

master
Richard Wackerbarth 9 years ago
commit 39092efe88

@ -306,6 +306,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

@ -196,7 +196,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
* A_AXIS and B_AXIS are used by COREXY printers * A_AXIS and B_AXIS are used by COREXY printers
* X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots. * X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots.
*/ */
enum AxisEnum {X_AXIS=0, Y_AXIS=1, A_AXIS=0, B_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5}; enum AxisEnum {X_AXIS=0, A_AXIS=0, Y_AXIS=1, B_AXIS=1, Z_AXIS=2, C_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5, Z_HEAD=5};
enum EndstopEnum {X_MIN=0, Y_MIN=1, Z_MIN=2, Z_PROBE=3, X_MAX=4, Y_MAX=5, Z_MAX=6, Z2_MIN=7, Z2_MAX=8}; enum EndstopEnum {X_MIN=0, Y_MIN=1, Z_MIN=2, Z_PROBE=3, X_MAX=4, Y_MAX=5, Z_MAX=6, Z2_MIN=7, Z2_MAX=8};

@ -306,6 +306,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

@ -288,6 +288,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

@ -273,6 +273,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

@ -298,6 +298,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

@ -294,6 +294,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

@ -306,6 +306,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

@ -314,6 +314,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

@ -298,6 +298,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

@ -306,6 +306,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

@ -306,6 +306,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
//=========================================================================== //===========================================================================
//============================== Delta Settings ============================= //============================== Delta Settings =============================
//=========================================================================== //===========================================================================

@ -306,6 +306,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
//=========================================================================== //===========================================================================
//============================== Delta Settings ============================= //============================== Delta Settings =============================
//=========================================================================== //===========================================================================

@ -306,6 +306,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
//=========================================================================== //===========================================================================
//============================== Delta Settings ============================= //============================== Delta Settings =============================
//=========================================================================== //===========================================================================

@ -293,6 +293,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
//=========================================================================== //===========================================================================
//============================== Delta Settings ============================= //============================== Delta Settings =============================
//=========================================================================== //===========================================================================

@ -309,6 +309,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA

@ -296,6 +296,9 @@ Here are some standard links for getting your machine calibrated:
// Uncomment this option to enable CoreXY kinematics // Uncomment this option to enable CoreXY kinematics
// #define COREXY // #define COREXY
// Uncomment this option to enable CoreXZ kinematics
// #define COREXZ
// Enable this option for Toshiba steppers // Enable this option for Toshiba steppers
#define CONFIG_STEPPERS_TOSHIBA #define CONFIG_STEPPERS_TOSHIBA

@ -541,13 +541,19 @@ float junction_deviation = 0.1;
// 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
block->steps[A_AXIS] = labs(dx + dy); block->steps[A_AXIS] = labs(dx + dy);
block->steps[B_AXIS] = labs(dx - dy); block->steps[B_AXIS] = labs(dx - dy);
block->steps[Z_AXIS] = labs(dz);
#elif defined(COREXZ)
// corexz planning
block->steps[A_AXIS] = labs(dx + dz);
block->steps[Y_AXIS] = labs(dy);
block->steps[C_AXIS] = labs(dx - dz);
#else #else
// default non-h-bot planning // default non-h-bot planning
block->steps[X_AXIS] = labs(dx); block->steps[X_AXIS] = labs(dx);
block->steps[Y_AXIS] = labs(dy); block->steps[Y_AXIS] = labs(dy);
block->steps[Z_AXIS] = labs(dz);
#endif #endif
block->steps[Z_AXIS] = labs(dz);
block->steps[E_AXIS] = labs(de); block->steps[E_AXIS] = labs(de);
block->steps[E_AXIS] *= volumetric_multiplier[extruder]; block->steps[E_AXIS] *= volumetric_multiplier[extruder];
block->steps[E_AXIS] *= extruder_multiplier[extruder]; block->steps[E_AXIS] *= extruder_multiplier[extruder];
@ -568,13 +574,20 @@ float junction_deviation = 0.1;
#ifdef COREXY #ifdef COREXY
if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) db |= BIT(Y_HEAD); // ...and Y if (dy < 0) db |= BIT(Y_HEAD); // ...and Y
if (dz < 0) db |= BIT(Z_AXIS);
if (dx + dy < 0) db |= BIT(A_AXIS); // Motor A direction if (dx + dy < 0) db |= BIT(A_AXIS); // Motor A direction
if (dx - dy < 0) db |= BIT(B_AXIS); // Motor B direction if (dx - dy < 0) db |= BIT(B_AXIS); // Motor B direction
#elif defined(COREXZ)
if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) db |= BIT(Y_AXIS);
if (dz < 0) db |= BIT(Z_HEAD); // ...and Z
if (dx + dz < 0) db |= BIT(A_AXIS); // Motor A direction
if (dx - dz < 0) db |= BIT(C_AXIS); // Motor B direction
#else #else
if (dx < 0) db |= BIT(X_AXIS); if (dx < 0) db |= BIT(X_AXIS);
if (dy < 0) db |= BIT(Y_AXIS); if (dy < 0) db |= BIT(Y_AXIS);
#endif
if (dz < 0) db |= BIT(Z_AXIS); if (dz < 0) db |= BIT(Z_AXIS);
#endif
if (de < 0) db |= BIT(E_AXIS); if (de < 0) db |= BIT(E_AXIS);
block->direction_bits = db; block->direction_bits = db;
@ -586,14 +599,21 @@ float junction_deviation = 0.1;
enable_x(); enable_x();
enable_y(); enable_y();
} }
#ifndef Z_LATE_ENABLE
if (block->steps[Z_AXIS]) enable_z();
#endif
#elif defined(COREXZ)
if (block->steps[A_AXIS] || block->steps[C_AXIS]) {
enable_x();
enable_z();
}
#else #else
if (block->steps[X_AXIS]) enable_x(); if (block->steps[X_AXIS]) enable_x();
if (block->steps[Y_AXIS]) enable_y(); if (block->steps[Y_AXIS]) enable_y();
#endif
#ifndef Z_LATE_ENABLE #ifndef Z_LATE_ENABLE
if (block->steps[Z_AXIS]) enable_z(); if (block->steps[Z_AXIS]) enable_z();
#endif #endif
#endif
// Enable extruder(s) // Enable extruder(s)
if (block->steps[E_AXIS]) { if (block->steps[E_AXIS]) {
@ -676,14 +696,22 @@ float junction_deviation = 0.1;
float delta_mm[6]; float delta_mm[6];
delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS]; delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS]; delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS];
delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
delta_mm[A_AXIS] = (dx + dy) / axis_steps_per_unit[A_AXIS]; delta_mm[A_AXIS] = (dx + dy) / axis_steps_per_unit[A_AXIS];
delta_mm[B_AXIS] = (dx - dy) / axis_steps_per_unit[B_AXIS]; delta_mm[B_AXIS] = (dx - dy) / axis_steps_per_unit[B_AXIS];
#elif defined(COREXZ)
float delta_mm[6];
delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
delta_mm[Z_HEAD] = dz / axis_steps_per_unit[C_AXIS];
delta_mm[A_AXIS] = (dx + dz) / axis_steps_per_unit[A_AXIS];
delta_mm[C_AXIS] = (dx - dz) / axis_steps_per_unit[C_AXIS];
#else #else
float delta_mm[4]; float delta_mm[4];
delta_mm[X_AXIS] = dx / axis_steps_per_unit[X_AXIS]; delta_mm[X_AXIS] = dx / axis_steps_per_unit[X_AXIS];
delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS]; delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
#endif
delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS]; delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
#endif
delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0; delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0;
if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) { if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
@ -692,11 +720,12 @@ float junction_deviation = 0.1;
else { else {
block->millimeters = sqrt( block->millimeters = sqrt(
#ifdef COREXY #ifdef COREXY
square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD]) square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD]) + square(delta_mm[Z_AXIS])
#elif defined(COREXZ)
square(delta_mm[X_HEAD]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_HEAD])
#else #else
square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS])
#endif #endif
+ square(delta_mm[Z_AXIS])
); );
} }
float inverse_millimeters = 1.0 / block->millimeters; // Inverse millimeters to remove multiple divides float inverse_millimeters = 1.0 / block->millimeters; // Inverse millimeters to remove multiple divides

@ -342,11 +342,15 @@ FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
return timer; return timer;
} }
// set the stepper direction of each axis /**
* Set the stepper direction of each axis
*
* X_AXIS=A_AXIS and Y_AXIS=B_AXIS for COREXY
* X_AXIS=A_AXIS and Z_AXIS=C_AXIS for COREXZ
*/
void set_stepper_direction() { void set_stepper_direction() {
// Set the direction bits (X_AXIS=A_AXIS and Y_AXIS=B_AXIS for COREXY) if (TEST(out_bits, X_AXIS)) { // A_AXIS
if (TEST(out_bits, X_AXIS)) {
X_APPLY_DIR(INVERT_X_DIR, 0); X_APPLY_DIR(INVERT_X_DIR, 0);
count_direction[X_AXIS] = -1; count_direction[X_AXIS] = -1;
} }
@ -355,7 +359,7 @@ void set_stepper_direction() {
count_direction[X_AXIS] = 1; count_direction[X_AXIS] = 1;
} }
if (TEST(out_bits, Y_AXIS)) { if (TEST(out_bits, Y_AXIS)) { // B_AXIS
Y_APPLY_DIR(INVERT_Y_DIR, 0); Y_APPLY_DIR(INVERT_Y_DIR, 0);
count_direction[Y_AXIS] = -1; count_direction[Y_AXIS] = -1;
} }
@ -364,7 +368,7 @@ void set_stepper_direction() {
count_direction[Y_AXIS] = 1; count_direction[Y_AXIS] = 1;
} }
if (TEST(out_bits, Z_AXIS)) { if (TEST(out_bits, Z_AXIS)) { // C_AXIS
Z_APPLY_DIR(INVERT_Z_DIR, 0); Z_APPLY_DIR(INVERT_Z_DIR, 0);
count_direction[Z_AXIS] = -1; count_direction[Z_AXIS] = -1;
} }
@ -503,6 +507,11 @@ ISR(TIMER1_COMPA_vect) {
// If DeltaX == -DeltaY, the movement is only in Y axis // If DeltaX == -DeltaY, the movement is only in Y axis
if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) { if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) {
if (TEST(out_bits, X_HEAD)) if (TEST(out_bits, X_HEAD))
#elif defined(COREXZ)
// Head direction in -X axis for CoreXZ bots.
// If DeltaX == -DeltaZ, the movement is only in Z axis
if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, C_AXIS))) {
if (TEST(out_bits, X_HEAD))
#else #else
if (TEST(out_bits, X_AXIS)) // stepping along -X axis (regular Cartesian bot) if (TEST(out_bits, X_AXIS)) // stepping along -X axis (regular Cartesian bot)
#endif #endif
@ -528,8 +537,11 @@ ISR(TIMER1_COMPA_vect) {
#endif #endif
} }
} }
#ifdef COREXY #if defined(COREXY) || defined(COREXZ)
} }
#endif
#ifdef COREXY
// Head direction in -Y axis for CoreXY bots. // Head direction in -Y axis for CoreXY bots.
// If DeltaX == DeltaY, the movement is only in X axis // If DeltaX == DeltaY, the movement is only in X axis
if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) { if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) {
@ -547,10 +559,19 @@ ISR(TIMER1_COMPA_vect) {
UPDATE_ENDSTOP(Y, MAX); UPDATE_ENDSTOP(Y, MAX);
#endif #endif
} }
#ifdef COREXY #if defined(COREXY) || defined(COREXZ)
} }
#endif #endif
if (TEST(out_bits, Z_AXIS)) { // z -direction
#ifdef COREXZ
// Head direction in -Z axis for CoreXZ bots.
// If DeltaX == DeltaZ, the movement is only in X axis
if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, C_AXIS))) {
if (TEST(out_bits, Z_HEAD))
#else
if (TEST(out_bits, Z_AXIS))
#endif
{ // z -direction
#if HAS_Z_MIN #if HAS_Z_MIN
#ifdef Z_DUAL_ENDSTOPS #ifdef Z_DUAL_ENDSTOPS

Loading…
Cancel
Save