From 95fee8ca819ac97ad281e7dcf976075506eac53f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 20 May 2016 13:22:16 -0700 Subject: [PATCH 1/4] Add option for CoreYZ kinematics --- Marlin/Configuration.h | 5 ++--- Marlin/example_configurations/Felix/Configuration.h | 5 ++--- Marlin/example_configurations/Felix/DUAL/Configuration.h | 5 ++--- Marlin/example_configurations/Hephestos/Configuration.h | 5 ++--- Marlin/example_configurations/Hephestos_2/Configuration.h | 5 ++--- Marlin/example_configurations/K8200/Configuration.h | 5 ++--- .../RepRapWorld/Megatronics/Configuration.h | 5 ++--- Marlin/example_configurations/RigidBot/Configuration.h | 5 ++--- Marlin/example_configurations/SCARA/Configuration.h | 5 ++--- Marlin/example_configurations/TAZ4/Configuration.h | 5 ++--- Marlin/example_configurations/WITBOX/Configuration.h | 5 ++--- .../example_configurations/adafruit/ST7565/Configuration.h | 5 ++--- Marlin/example_configurations/delta/biv2.5/Configuration.h | 5 ++--- Marlin/example_configurations/delta/generic/Configuration.h | 5 ++--- .../example_configurations/delta/kossel_mini/Configuration.h | 5 ++--- .../example_configurations/delta/kossel_pro/Configuration.h | 5 ++--- .../example_configurations/delta/kossel_xl/Configuration.h | 5 ++--- Marlin/example_configurations/makibox/Configuration.h | 5 ++--- Marlin/example_configurations/tvrrug/Round2/Configuration.h | 5 ++--- 19 files changed, 38 insertions(+), 57 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 87c72790b3..a595524bff 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -342,11 +342,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/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 1092bf3351..faece4547e 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -324,11 +324,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 1c16d5ca0e..b6acb9c01a 100644 --- a/Marlin/example_configurations/Felix/DUAL/Configuration.h +++ b/Marlin/example_configurations/Felix/DUAL/Configuration.h @@ -322,11 +322,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 e25ea5bd8d..f1f8743ebe 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/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 // 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 5f2e0d5336..948c4b4040 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration.h @@ -336,11 +336,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 00fa13f355..5a5d7f84e8 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -359,11 +359,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 6f1ee7d2e0..31a4a76c0d 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -342,11 +342,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 09166c2297..395192b117 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -336,11 +336,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 b16745e513..467629caa3 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -350,11 +350,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 6bc9693270..60e263c057 100644 --- a/Marlin/example_configurations/TAZ4/Configuration.h +++ b/Marlin/example_configurations/TAZ4/Configuration.h @@ -363,11 +363,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 1c87153c73..4d7ed69c75 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/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 // 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 96619e79c7..f407cff08e 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -342,11 +342,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 f041c17ffd..1c27aebc3a 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration.h @@ -342,11 +342,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 c2dd7084f4..d0f791f74f 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -342,11 +342,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 b12418733e..9a4d7d8aef 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -342,11 +342,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 1608e36b7a..a32794e270 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -331,11 +331,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 9ac5519151..9b9311b3a3 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -340,11 +340,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 2fc005342b..6d75a3617e 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/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/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 02c6e6c4df..656da8db65 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -332,11 +332,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 From 6c7f4909b1cb18f5eed886a7ae03d1f9f810c20b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 20 May 2016 13:28:00 -0700 Subject: [PATCH 2/4] COREYZ Conditionals, SanityCheck for only a single kinematic --- Marlin/Conditionals.h | 10 ++++++++-- Marlin/SanityCheck.h | 10 ++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index 4583a0a5fb..4541c857cb 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 CORE_AXIS_3 Z_AXIS // normal 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 CORE_AXIS_3 Y_AXIS // normal axis + #elif ENABLED(COREYZ) + #define CORE_AXIS_1 B_AXIS // YZ from B + C + #define CORE_AXIS_2 C_AXIS + #define CORE_AXIS_3 X_AXIS // normal axis #endif /** diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index c499c2c967..718022ff7f 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -387,6 +387,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 */ From 5172d4ba40dff7f046ba70b32d274e94b36fb9f7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 20 May 2016 13:27:49 -0700 Subject: [PATCH 3/4] COREYZ stepper, planner, endstop, babysteps --- Marlin/endstops.cpp | 22 ++++++++++---------- Marlin/planner.cpp | 48 +++++++++++++++++++++++++++++++------------- Marlin/planner.h | 2 +- Marlin/stepper.cpp | 33 ++++++++++++++++++------------ Marlin/temperature.h | 19 +++++++++--------- 5 files changed, 76 insertions(+), 48 deletions(-) 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/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..ef47ed209b 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 + case CORE_AXIS_3: // Z on CoreXY, Y on CoreXZ, X on CoreYZ babystepsTodo[CORE_AXIS_3] += 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 From 0e55c06f7d6fc9398c7f569b6e9e2b5516ae833a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 20 May 2016 13:32:30 -0700 Subject: [PATCH 4/4] Rename CORE_AXIS_3 to NORMAL_AXIS --- Marlin/Conditionals.h | 6 +++--- Marlin/temperature.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index 4541c857cb..f569a53e15 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -317,15 +317,15 @@ #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 // normal 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 // normal 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 CORE_AXIS_3 X_AXIS // normal axis + #define NORMAL_AXIS X_AXIS #endif /** diff --git a/Marlin/temperature.h b/Marlin/temperature.h index ef47ed209b..1e9276a804 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -317,8 +317,8 @@ class Temperature { babystepsTodo[CORE_AXIS_1] += distance * 2; babystepsTodo[CORE_AXIS_2] -= distance * 2; break; - case CORE_AXIS_3: // Z on CoreXY, Y on CoreXZ, X on CoreYZ - 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) || ENABLED(COREYZ)