Commit b5c2d02a authored by MagoKimbra's avatar MagoKimbra

Fix COREXY and COREXZ

parent 303c6865
...@@ -63,13 +63,6 @@ ...@@ -63,13 +63,6 @@
//#define SCARA //#define SCARA
/***********************************************************************\ /***********************************************************************\
/***********************************************************************\
************************ CORE X (YZ) MOLTIPLICATOR ********************
***********************************************************************/
// This define the moltiplicator axis from X to Y or Z in COREXY or
// COREXZ. Normally is equal 1.
#define COREX_MOLTIPLICATOR 1
/***********************************************************************\ /***********************************************************************\
********************** Do not touch this section ********************** ********************** Do not touch this section **********************
***********************************************************************/ ***********************************************************************/
......
...@@ -6,6 +6,21 @@ ...@@ -6,6 +6,21 @@
//=============================Mechanical Settings=========================== //=============================Mechanical Settings===========================
//=========================================================================== //===========================================================================
/***********************************************************************
************************ CORE X (YZ) MOLTIPLICATOR ********************
***********************************************************************
* This define the moltiplicator axis from X to Y or Z in COREXY or
* COREXZ.
* Example:
* COREXY set COREX_XZ_FACTOR 1
* The result is:
* X = dX + COREX_YZ_FACTOR * dY = dX + 1 * dY = dX + dY
* Y = dX - COREX_YZ_FACTOR * dY = dX - 1 * dY = dX - dY
* Z = dZ
*/
#define COREX_YZ_FACTOR 1
// coarse Endstop Settings // coarse Endstop Settings
#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
......
...@@ -521,9 +521,12 @@ float junction_deviation = 0.1; ...@@ -521,9 +521,12 @@ float junction_deviation = 0.1;
dy = target[Y_AXIS] - position[Y_AXIS], dy = target[Y_AXIS] - position[Y_AXIS],
dz = target[Z_AXIS] - position[Z_AXIS], dz = target[Z_AXIS] - position[Z_AXIS],
de = target[E_AXIS] - position[E_AXIS]; de = target[E_AXIS] - position[E_AXIS];
#if ENABLED(COREXY)
#if ENABLED(COREXY) || ENABLED(COREXZ) float da = dx + COREX_YZ_FACTOR * dy;
int MX = COREX_MOLTIPLICATOR; float db = dx - COREX_YZ_FACTOR * dy;
#elif ENABLED(COREXZ)
float da = dx + COREX_YZ_FACTOR * dz;
float dc = dx - COREX_YZ_FACTOR * dz;
#endif #endif
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE) #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
...@@ -566,14 +569,14 @@ float junction_deviation = 0.1; ...@@ -566,14 +569,14 @@ float junction_deviation = 0.1;
#if ENABLED(COREXY) #if ENABLED(COREXY)
// corexy planning // corexy planning
// 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 + MX * dy); block->steps[A_AXIS] = labs(da);
block->steps[B_AXIS] = labs(dx - MX * dy); block->steps[B_AXIS] = labs(db);
block->steps[Z_AXIS] = labs(dz); block->steps[Z_AXIS] = labs(dz);
#elif ENABLED(COREXZ) #elif ENABLED(COREXZ)
// corexz planning // corexz planning
block->steps[A_AXIS] = labs(dx + MX * dz); block->steps[A_AXIS] = labs(da);
block->steps[Y_AXIS] = labs(dy); block->steps[Y_AXIS] = labs(dy);
block->steps[C_AXIS] = labs(dx - MX * dz); block->steps[C_AXIS] = labs(dc);
#else #else
// default non-h-bot planning // default non-h-bot planning
block->steps[X_AXIS] = labs(dx); block->steps[X_AXIS] = labs(dx);
...@@ -607,14 +610,14 @@ float junction_deviation = 0.1; ...@@ -607,14 +610,14 @@ float junction_deviation = 0.1;
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 (dz < 0) db |= BIT(Z_AXIS);
if (dx + MX * dy < 0) db |= BIT(A_AXIS); // Motor A direction if (da < 0) db |= BIT(A_AXIS); // Motor A direction
if (dx - MX * dy < 0) db |= BIT(B_AXIS); // Motor B direction if (db < 0) db |= BIT(B_AXIS); // Motor B direction
#elif ENABLED(COREXZ) #elif ENABLED(COREXZ)
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_AXIS); if (dy < 0) db |= BIT(Y_AXIS);
if (dz < 0) db |= BIT(Z_HEAD); // ...and Z if (dz < 0) db |= BIT(Z_HEAD); // ...and Z
if (dx + MX * dz < 0) db |= BIT(A_AXIS); // Motor A direction if (da < 0) db |= BIT(A_AXIS); // Motor A direction
if (dx - MX * dz < 0) db |= BIT(C_AXIS); // Motor B direction if (dc < 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);
...@@ -749,15 +752,15 @@ float junction_deviation = 0.1; ...@@ -749,15 +752,15 @@ float junction_deviation = 0.1;
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[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
delta_mm[A_AXIS] = (dx + MX * dy) / axis_steps_per_unit[A_AXIS]; delta_mm[A_AXIS] = da / axis_steps_per_unit[A_AXIS];
delta_mm[B_AXIS] = (dx - MX * dy) / axis_steps_per_unit[B_AXIS]; delta_mm[B_AXIS] = db / axis_steps_per_unit[B_AXIS];
#elif ENABLED(COREXZ) #elif ENABLED(COREXZ)
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_AXIS] = dy / axis_steps_per_unit[Y_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[Z_HEAD] = dz / axis_steps_per_unit[C_AXIS];
delta_mm[A_AXIS] = (dx + MX * dz) / axis_steps_per_unit[A_AXIS]; delta_mm[A_AXIS] = da / axis_steps_per_unit[A_AXIS];
delta_mm[C_AXIS] = (dx - MX * dz) / axis_steps_per_unit[C_AXIS]; delta_mm[C_AXIS] = dc / 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];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment