diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index 386f836d22..6bef2521a8 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -315,11 +315,17 @@ * CoreXY and CoreXZ */ #if ENABLED(COREXY) + #define CORE_AXIS_1 A_AXIS // XY from A + B #define CORE_AXIS_2 B_AXIS - #define CORE_AXIS_3 Z_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 CORE_AXIS_3 Y_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 #endif /** diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index a79b38e5a9..fe14777ea7 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -345,11 +345,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 3a6e6a895c..3fa6788a79 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -389,6 +389,16 @@ #endif +/** + * Don't set more than one kinematic type + */ +#if (ENABLED(DELTA) && (ENABLED(SCARA) || ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ))) \ + || (ENABLED(SCARA) && (ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ))) \ + || (ENABLED(COREXY) && (ENABLED(COREXZ) || ENABLED(COREYZ))) \ + || (ENABLED(COREXZ) && ENABLED(COREYZ)) + #error "Please enable only one of DELTA, SCARA, COREXY, COREXZ, or COREYZ." +#endif + /** * Allen Key Z probe requires Auto Bed Leveling grid and Delta */ diff --git a/Marlin/endstops.cpp b/Marlin/endstops.cpp index 018b9568b5..49da0012a3 100644 --- a/Marlin/endstops.cpp +++ b/Marlin/endstops.cpp @@ -239,8 +239,8 @@ void Endstops::update() { #if ENABLED(COREXY) || ENABLED(COREXZ) // Head direction in -X axis for CoreXY and CoreXZ bots. - // If Delta1 == -Delta2, the movement is only in Y or Z axis - if ((stepper.current_block->steps[A_AXIS] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(A_AXIS) == stepper.motor_direction(CORE_AXIS_2))) { + // 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.motor_direction(X_HEAD)) #else if (stepper.motor_direction(X_AXIS)) // stepping along -X axis (regular Cartesian bot) @@ -271,10 +271,10 @@ void Endstops::update() { } #endif - #if ENABLED(COREXY) - // Head direction in -Y axis for CoreXY bots. - // If DeltaX == DeltaY, the movement is only in X axis - if ((stepper.current_block->steps[A_AXIS] != stepper.current_block->steps[B_AXIS]) || (stepper.motor_direction(A_AXIS) != stepper.motor_direction(B_AXIS))) { + #if ENABLED(COREXY) || ENABLED(COREYZ) + // 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))) { if (stepper.motor_direction(Y_HEAD)) #else if (stepper.motor_direction(Y_AXIS)) // -direction @@ -289,14 +289,14 @@ void Endstops::update() { UPDATE_ENDSTOP(Y, MAX); #endif } - #if ENABLED(COREXY) + #if ENABLED(COREXY) || ENABLED(COREYZ) } #endif - #if ENABLED(COREXZ) - // Head direction in -Z axis for CoreXZ bots. - // If DeltaX == DeltaZ, the movement is only in X axis - if ((stepper.current_block->steps[A_AXIS] != stepper.current_block->steps[C_AXIS]) || (stepper.motor_direction(A_AXIS) != stepper.motor_direction(C_AXIS))) { + #if ENABLED(COREXZ) || ENABLED(COREYZ) + // 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))) { if (stepper.motor_direction(Z_HEAD)) #else if (stepper.motor_direction(Z_AXIS)) diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 3a9a93acd0..3b9c62184a 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -327,11 +327,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/example_configurations/Felix/DUAL/Configuration.h b/Marlin/example_configurations/Felix/DUAL/Configuration.h index 4d05e471a5..c4e03aadaa 100644 --- a/Marlin/example_configurations/Felix/DUAL/Configuration.h +++ b/Marlin/example_configurations/Felix/DUAL/Configuration.h @@ -325,11 +325,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 279c7ed20c..a2a43ed9b9 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -337,11 +337,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/example_configurations/Hephestos_2/Configuration.h b/Marlin/example_configurations/Hephestos_2/Configuration.h index 48d41042a3..3be2505bb2 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration.h @@ -339,11 +339,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index 8cbf115d7e..c9dc2c3feb 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -362,11 +362,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index 0a9ca7313c..4c03ddf3c0 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -345,11 +345,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/example_configurations/RigidBot/Configuration.h b/Marlin/example_configurations/RigidBot/Configuration.h index 85a1332c88..e3d38fda03 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -339,11 +339,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index e401ae888d..15e83223ee 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -353,11 +353,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/example_configurations/TAZ4/Configuration.h b/Marlin/example_configurations/TAZ4/Configuration.h index 6cb82b6618..f65443b6dd 100644 --- a/Marlin/example_configurations/TAZ4/Configuration.h +++ b/Marlin/example_configurations/TAZ4/Configuration.h @@ -366,11 +366,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index ae2cb6a21a..380759fc80 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -337,11 +337,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index 5d50a80614..12142aff02 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -345,11 +345,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration.h b/Marlin/example_configurations/delta/biv2.5/Configuration.h index aa47652189..9ccfaca36d 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration.h @@ -345,11 +345,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ //=========================================================================== //============================== Delta Settings ============================= diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 4300ccc53a..1465d2d4c0 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -345,11 +345,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ //=========================================================================== //============================== Delta Settings ============================= diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 79a3ea82b0..c432ec4700 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -345,11 +345,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ //=========================================================================== //============================== Delta Settings ============================= diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index 197aa574cc..8c7042f7bd 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -334,11 +334,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ //=========================================================================== //============================== Delta Settings ============================= diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index 1fb903aba6..b0ce02ff80 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -343,11 +343,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ //=========================================================================== //============================== Delta Settings ============================= diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 67faff3fbd..f331853821 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -348,11 +348,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 5498e55403..3b6abfec50 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -335,11 +335,10 @@ // @section machine -// Uncomment this option to enable CoreXY kinematics +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics //#define COREXY - -// Uncomment this option to enable CoreXZ kinematics //#define COREXZ +//#define COREYZ // Enable this option for Toshiba steppers #define CONFIG_STEPPERS_TOSHIBA diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 36c3a262e6..05a3c7174e 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -543,6 +543,11 @@ void Planner::check_axes_activity() { block->steps[A_AXIS] = labs(dx + dz); block->steps[Y_AXIS] = labs(dy); block->steps[C_AXIS] = labs(dx - dz); + #elif ENABLED(COREYZ) + // coreyz planning + block->steps[X_AXIS] = labs(dx); + block->steps[B_AXIS] = labs(dy + dz); + block->steps[C_AXIS] = labs(dy - dz); #else // default non-h-bot planning block->steps[X_AXIS] = labs(dx); @@ -581,7 +586,13 @@ void Planner::check_axes_activity() { if (dy < 0) SBI(db, Y_AXIS); if (dz < 0) SBI(db, Z_HEAD); // ...and Z if (dx + dz < 0) SBI(db, A_AXIS); // Motor A direction - if (dx - dz < 0) SBI(db, C_AXIS); // Motor B direction + if (dx - dz < 0) SBI(db, C_AXIS); // Motor C direction + #elif ENABLED(COREYZ) + if (dx < 0) SBI(db, X_AXIS); + if (dy < 0) SBI(db, Y_HEAD); // Save the real Extruder (head) direction in Y Axis + if (dz < 0) SBI(db, Z_HEAD); // ...and Z + if (dy + dz < 0) SBI(db, B_AXIS); // Motor B direction + if (dy - dz < 0) SBI(db, C_AXIS); // Motor C direction #else if (dx < 0) SBI(db, X_AXIS); if (dy < 0) SBI(db, Y_AXIS); @@ -698,20 +709,27 @@ void Planner::check_axes_activity() { * 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) + #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ) float delta_mm[6]; - delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_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[B_AXIS] = (dx - dy) / axis_steps_per_unit[B_AXIS]; - #elif ENABLED(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]; + #if ENABLED(COREXY) + delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_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[B_AXIS] = (dx - dy) / axis_steps_per_unit[B_AXIS]; + #elif ENABLED(COREXZ) + 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]; + #elif ENABLED(COREYZ) + delta_mm[X_AXIS] = dx / axis_steps_per_unit[A_AXIS]; + delta_mm[Y_HEAD] = dy / axis_steps_per_unit[Y_AXIS]; + delta_mm[Z_HEAD] = dz / axis_steps_per_unit[C_AXIS]; + delta_mm[B_AXIS] = (dy + dz) / axis_steps_per_unit[B_AXIS]; + delta_mm[C_AXIS] = (dy - dz) / axis_steps_per_unit[C_AXIS]; + #endif #else float delta_mm[4]; delta_mm[X_AXIS] = dx / axis_steps_per_unit[X_AXIS]; @@ -729,6 +747,8 @@ void Planner::check_axes_activity() { square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD]) + square(delta_mm[Z_AXIS]) #elif ENABLED(COREXZ) square(delta_mm[X_HEAD]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_HEAD]) + #elif ENABLED(COREYZ) + square(delta_mm[X_AXIS]) + square(delta_mm[Y_HEAD]) + square(delta_mm[Z_HEAD]) #else square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS]) #endif diff --git a/Marlin/planner.h b/Marlin/planner.h index bd178d2577..f62398397a 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -204,7 +204,7 @@ class Planner { * Used by G92, G28, G29, and other procedures. * * Multiplies by axis_steps_per_unit[] and does necessary conversion - * for COREXY / COREXZ to set the corresponding stepper positions. + * for COREXY / COREXZ / COREYZ to set the corresponding stepper positions. * * Clears previous speed values. */ diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 909d86b555..e1a06be8b5 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -204,8 +204,9 @@ void Stepper::wake_up() { /** * 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 + * COREXY: X_AXIS=A_AXIS and Y_AXIS=B_AXIS + * COREXZ: X_AXIS=A_AXIS and Z_AXIS=C_AXIS + * COREYZ: Y_AXIS=B_AXIS and Z_AXIS=C_AXIS */ void Stepper::set_directions() { @@ -649,6 +650,11 @@ void Stepper::set_position(const long& x, const long& y, const long& z, const lo count_position[A_AXIS] = x + z; count_position[Y_AXIS] = y; count_position[C_AXIS] = x - z; + #elif ENABLED(COREYZ) + // coreyz planning + count_position[X_AXIS] = x; + count_position[B_AXIS] = y + z; + count_position[C_AXIS] = y - z; #else // default non-h-bot planning count_position[X_AXIS] = x; @@ -682,15 +688,16 @@ long Stepper::position(AxisEnum axis) { */ float Stepper::get_axis_position_mm(AxisEnum axis) { float axis_steps; - #if ENABLED(COREXY) | ENABLED(COREXZ) - if (axis == X_AXIS || axis == CORE_AXIS_2) { + #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ) + // Requesting one of the "core" axes? + if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) { CRITICAL_SECTION_START; - long pos1 = count_position[A_AXIS], + 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 == X_AXIS) ? pos2 : -pos2)) / 2.0f; + axis_steps = (pos1 + ((axis == CORE_AXIS_1) ? pos2 : -pos2)) / 2.0f; } else axis_steps = position(axis); @@ -715,20 +722,20 @@ void Stepper::quick_stop() { void Stepper::endstop_triggered(AxisEnum axis) { - #if ENABLED(COREXY) || ENABLED(COREXZ) + #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ) float axis_pos = count_position[axis]; - if (axis == A_AXIS) + if (axis == CORE_AXIS_1) axis_pos = (axis_pos + count_position[CORE_AXIS_2]) / 2; else if (axis == CORE_AXIS_2) - axis_pos = (count_position[A_AXIS] - axis_pos) / 2; + axis_pos = (count_position[CORE_AXIS_1] - axis_pos) / 2; endstops_trigsteps[axis] = axis_pos; - #else // !COREXY && !COREXZ + #else // !COREXY && !COREXZ && !COREYZ endstops_trigsteps[axis] = count_position[axis]; - #endif // !COREXY && !COREXZ + #endif // !COREXY && !COREXZ && !COREYZ kill_current_block(); } @@ -747,14 +754,14 @@ void Stepper::report_positions() { #endif SERIAL_PROTOCOL(xpos); - #if ENABLED(COREXY) || ENABLED(COREXZ) + #if ENABLED(COREXY) || ENABLED(COREYZ) SERIAL_PROTOCOLPGM(" B:"); #else SERIAL_PROTOCOLPGM(" Y:"); #endif SERIAL_PROTOCOL(ypos); - #if ENABLED(COREXZ) || ENABLED(COREXZ) + #if ENABLED(COREXZ) || ENABLED(COREYZ) SERIAL_PROTOCOLPGM(" C:"); #else SERIAL_PROTOCOLPGM(" Z:"); diff --git a/Marlin/temperature.h b/Marlin/temperature.h index a178f1fed0..1e9276a804 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -306,24 +306,25 @@ class Temperature { #if ENABLED(BABYSTEPPING) FORCE_INLINE void babystep_axis(AxisEnum axis, int distance) { - #if ENABLED(COREXY) || ENABLED(COREXZ) + #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ) #if ENABLED(BABYSTEP_XY) switch (axis) { - case X_AXIS: // X on CoreXY and CoreXZ - babystepsTodo[A_AXIS] += distance * 2; + case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ + babystepsTodo[CORE_AXIS_1] += distance * 2; babystepsTodo[CORE_AXIS_2] += distance * 2; break; - case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ - babystepsTodo[A_AXIS] += distance * 2; + case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ + babystepsTodo[CORE_AXIS_1] += distance * 2; babystepsTodo[CORE_AXIS_2] -= distance * 2; break; - case CORE_AXIS_3: // Z on CoreXY, Y on CoreXZ - babystepsTodo[CORE_AXIS_3] += distance; + case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ + babystepsTodo[NORMAL_AXIS] += distance; break; } - #elif ENABLED(COREXZ) - babystepsTodo[A_AXIS] += distance * 2; - babystepsTodo[C_AXIS] -= distance * 2; + #elif ENABLED(COREXZ) || ENABLED(COREYZ) + // Only Z stepping needs to be handled here + babystepsTodo[CORE_AXIS_1] += distance * 2; + babystepsTodo[CORE_AXIS_2] -= distance * 2; #else babystepsTodo[Z_AXIS] += distance; #endif