Commit 47628402 authored by MagoKimbra's avatar MagoKimbra

Add COREXZ mechanism

parent 6bbb3e37
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
***********************************************************************/ ***********************************************************************/
#define CARTESIAN #define CARTESIAN
//#define COREXY //#define COREXY
//#define COREXZ
//#define DELTA //#define DELTA
//#define SCARA //#define SCARA
/***********************************************************************\ /***********************************************************************\
...@@ -67,7 +68,9 @@ ...@@ -67,7 +68,9 @@
#if defined(CARTESIAN) #if defined(CARTESIAN)
#include "Configuration_Cartesian.h" #include "Configuration_Cartesian.h"
#elif defined(COREXY) #elif defined(COREXY)
#include "Configuration_Corexy.h" #include "Configuration_Core.h"
#elif defined(COREXZ)
#include "Configuration_Core.h"
#elif defined(DELTA) #elif defined(DELTA)
#include "Configuration_Delta.h" #include "Configuration_Delta.h"
#elif defined(SCARA) #elif defined(SCARA)
......
// Define this to set a custom name for your generic Mendel, // Define this to set a custom name for your generic Mendel,
// Displayed in the LCD "Ready" message // Displayed in the LCD "Ready" message
#define CUSTOM_MACHINE_NAME "Core XY" #define CUSTOM_MACHINE_NAME "Core"
//=========================================================================== //===========================================================================
//=============================Mechanical Settings=========================== //=============================Mechanical Settings===========================
......
...@@ -29,11 +29,7 @@ ...@@ -29,11 +29,7 @@
#error Your Configuration.h and Configuration_adv.h files are outdated! #error Your Configuration.h and Configuration_adv.h files are outdated!
#endif #endif
#if (ARDUINO >= 100) #include "Arduino.h"
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
// Macros for bit masks // Macros for bit masks
#define BIT(b) (1<<(b)) #define BIT(b) (1<<(b))
...@@ -148,7 +144,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); ...@@ -148,7 +144,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};
......
...@@ -1046,7 +1046,7 @@ static const PROGMEM type array##_P[3] = \ ...@@ -1046,7 +1046,7 @@ static const PROGMEM type array##_P[3] = \
static inline type array(int axis) \ static inline type array(int axis) \
{ return pgm_read_any(&array##_P[axis]); } { return pgm_read_any(&array##_P[axis]); }
#if defined(CARTESIAN) || defined(COREXY) || defined(SCARA) #if defined(CARTESIAN) || defined(COREXY) || defined(COREXZ) || defined(SCARA)
XYZ_CONSTS_FROM_CONFIG(float, base_max_pos, MAX_POS); XYZ_CONSTS_FROM_CONFIG(float, base_max_pos, MAX_POS);
XYZ_CONSTS_FROM_CONFIG(float, base_home_pos, HOME_POS); XYZ_CONSTS_FROM_CONFIG(float, base_home_pos, HOME_POS);
XYZ_CONSTS_FROM_CONFIG(float, max_length, MAX_LENGTH); XYZ_CONSTS_FROM_CONFIG(float, max_length, MAX_LENGTH);
...@@ -1217,7 +1217,7 @@ static void setup_for_endstop_move() { ...@@ -1217,7 +1217,7 @@ static void setup_for_endstop_move() {
enable_endstops(true); enable_endstops(true);
} }
#if defined(CARTESIAN) || defined(COREXY) || defined(SCARA) #if defined(CARTESIAN) || defined(COREXY) || defined(COREXZ) || defined(SCARA)
static void do_blocking_move_to(float x, float y, float z) { static void do_blocking_move_to(float x, float y, float z) {
float oldFeedRate = feedrate; float oldFeedRate = feedrate;
...@@ -1538,7 +1538,7 @@ static void setup_for_endstop_move() { ...@@ -1538,7 +1538,7 @@ static void setup_for_endstop_move() {
} }
} }
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS) #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
#endif // Cartesian || CoreXY || Scara #endif // CARTESIAN || COREXY || COREXZ || SCARA
#ifdef DELTA #ifdef DELTA
...@@ -6754,7 +6754,7 @@ FORCE_INLINE void clamp_to_software_endstops(float target[3]) { ...@@ -6754,7 +6754,7 @@ FORCE_INLINE void clamp_to_software_endstops(float target[3]) {
#endif // DUAL_X_CARRIAGE #endif // DUAL_X_CARRIAGE
#if defined(CARTESIAN) || defined(COREXY) #if defined(CARTESIAN) || defined(COREXY) || defined(COREXZ)
inline bool prepare_move_cartesian() { inline bool prepare_move_cartesian() {
// Do not use feedrate_multiplier for E or Z only moves // Do not use feedrate_multiplier for E or Z only moves
...@@ -6767,7 +6767,7 @@ FORCE_INLINE void clamp_to_software_endstops(float target[3]) { ...@@ -6767,7 +6767,7 @@ FORCE_INLINE void clamp_to_software_endstops(float target[3]) {
return true; return true;
} }
#endif // CARTESIAN || COREXY #endif // CARTESIAN || COREXY || COREXZ
/** /**
* Prepare a single move and get ready for the next one * Prepare a single move and get ready for the next one
...@@ -6790,7 +6790,7 @@ void prepare_move() { ...@@ -6790,7 +6790,7 @@ void prepare_move() {
if (!prepare_move_dual_x_carriage()) return; if (!prepare_move_dual_x_carriage()) return;
#endif #endif
#if defined(CARTESIAN) || defined(COREXY) #if defined(CARTESIAN) || defined(COREXY) || defined(COREXZ)
if (!prepare_move_cartesian()) return; if (!prepare_move_cartesian()) return;
#endif #endif
......
...@@ -2,12 +2,8 @@ ...@@ -2,12 +2,8 @@
blinkm.h blinkm.h
Library header file for BlinkM library Library header file for BlinkM library
*/ */
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "Arduino.h"
#include "Wire.h" #include "Wire.h"
void SendColors(byte red, byte grn, byte blu); void SendColors(byte red, byte grn, byte blu);
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 / 1.4 (Power outputs: Hotend, Fan, Fan) #define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 / 1.4 (Power outputs: Hotend, Fan, Fan)
#define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 / 1.4 (Power outputs: Hotend0, Hotend1, Fan) #define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 / 1.4 (Power outputs: Hotend0, Hotend1, Fan)
#define BOARD_RAMBO 301 // Rambo #define BOARD_RAMBO 301 // Rambo
#define BOARD_MINIRAMBO 302 // Mini-Rambo
#define BOARD_DUEMILANOVE_328P 4 // Duemilanove w/ ATMega328P pin assignments #define BOARD_DUEMILANOVE_328P 4 // Duemilanove w/ ATMega328P pin assignments
#define BOARD_RADDS 402 // RADDS #define BOARD_RADDS 402 // RADDS
...@@ -42,7 +43,7 @@ ...@@ -42,7 +43,7 @@
#define BOARD_ULTIMAKER 7 // Ultimaker #define BOARD_ULTIMAKER 7 // Ultimaker
#define BOARD_MEGATRONICS 70 // Megatronics #define BOARD_MEGATRONICS 70 // Megatronics
#define BOARD_MEGATRONICS_2 701 // Megatronics v2.0 #define BOARD_MEGATRONICS_2 701 // Megatronics v2.0
#define BOARD_MEGATRONICS_1 702 // Minitronics v1.0 #define BOARD_MINITRONICS 702 // Minitronics v1.0
#define BOARD_MEGATRONICS_3 703 // Megatronics v3.0 #define BOARD_MEGATRONICS_3 703 // Megatronics v3.0
#define BOARD_ULTIMAKER_OLD 71 // Ultimaker (Older electronics. Pre 1.5.4. This is rare) #define BOARD_ULTIMAKER_OLD 71 // Ultimaker (Older electronics. Pre 1.5.4. This is rare)
#define BOARD_ULTIMAIN_2 72 // Ultimainboard 2.x (Uses TEMP_SENSOR 20) #define BOARD_ULTIMAIN_2 72 // Ultimainboard 2.x (Uses TEMP_SENSOR 20)
......
...@@ -381,15 +381,15 @@ ...@@ -381,15 +381,15 @@
* MAX_STEP_FREQUENCY differs for TOSHIBA OR ARDUINO DUE OR ARDUINO MEGA * MAX_STEP_FREQUENCY differs for TOSHIBA OR ARDUINO DUE OR ARDUINO MEGA
*/ */
#ifdef __SAM3X8E__ #ifdef __SAM3X8E__
#ifdef CONFIG_STEPPERS_TOSHIBA #if defined(CONFIG_STEPPERS_TOSHIBA) || !defined(ENABLE_HIGH_SPEED_STEPPING)
#define MAX_STEP_FREQUENCY 120000 // Max step frequency for Toshiba Stepper Controllers #define MAX_STEP_FREQUENCY 150000 // Max step frequency for Toshiba Stepper Controllers
#define DOUBLE_STEP_FREQUENCY MAX_STEP_FREQUENCY #define DOUBLE_STEP_FREQUENCY MAX_STEP_FREQUENCY
#else #else
#define MAX_STEP_FREQUENCY 500000 // Max step frequency for the Due is approx. 330kHz #define MAX_STEP_FREQUENCY 500000 // Max step frequency for the Due is approx. 330kHz
#define DOUBLE_STEP_FREQUENCY 120000 //96kHz is close to maximum for an Arduino Due #define DOUBLE_STEP_FREQUENCY 120000 //96kHz is close to maximum for an Arduino Due
#endif #endif
#else #else
#ifdef CONFIG_STEPPERS_TOSHIBA #if defined(CONFIG_STEPPERS_TOSHIBA) || !defined(ENABLE_HIGH_SPEED_STEPPING)
#define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers #define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers
#define DOUBLE_STEP_FREQUENCY MAX_STEP_FREQUENCY #define DOUBLE_STEP_FREQUENCY MAX_STEP_FREQUENCY
#else #else
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* 36 BOARD_RAMPS_13_EEF - RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Fan) * 36 BOARD_RAMPS_13_EEF - RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Fan)
* *
*301 BOARD_RAMBO - Rambo *301 BOARD_RAMBO - Rambo
*302 BOARD_MINIRAMBO - Mini Rambo
* *
* 4 BOARD_DUEMILANOVE_328P - Duemilanove w/ ATMega328P pin assignment * 4 BOARD_DUEMILANOVE_328P - Duemilanove w/ ATMega328P pin assignment
*401 BOARD_RADDS - Radds Arduino DUE *401 BOARD_RADDS - Radds Arduino DUE
...@@ -45,7 +46,7 @@ ...@@ -45,7 +46,7 @@
* *
* 70 BOARD_MEGATRONICS - Megatronics * 70 BOARD_MEGATRONICS - Megatronics
*701 BOARD_MEGATRONICS_2 - Megatronics v2.0 *701 BOARD_MEGATRONICS_2 - Megatronics v2.0
*702 BOARD_MEGATRONICS_1 - Minitronics v1.0 *702 BOARD_MINITRONICS - Minitronics v1.0
*703 BOARD_MEGATRONICS_3 - Megatronics v3.0 *703 BOARD_MEGATRONICS_3 - Megatronics v3.0
* 71 BOARD_ULTIMAKER_OLD - Ultimaker (Older electronics. Pre 1.5.4. This is rare) * 71 BOARD_ULTIMAKER_OLD - Ultimaker (Older electronics. Pre 1.5.4. This is rare)
* 72 BOARD_ULTIMAIN_2 - Ultimainboard 2.x (Uses TEMP_SENSOR 20) * 72 BOARD_ULTIMAIN_2 - Ultimainboard 2.x (Uses TEMP_SENSOR 20)
...@@ -3327,7 +3328,7 @@ ...@@ -3327,7 +3328,7 @@
* Minitronics v1.0 * Minitronics v1.0
****************************************************************************************/ ****************************************************************************************/
#if MB(MEGATRONICS_1) #if MB(MINITRONICS)
#define KNOWN_BOARD 1 #define KNOWN_BOARD 1
......
...@@ -552,13 +552,19 @@ float junction_deviation = 0.1; ...@@ -552,13 +552,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];
...@@ -584,13 +590,20 @@ float junction_deviation = 0.1; ...@@ -584,13 +590,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;
...@@ -602,14 +615,21 @@ float junction_deviation = 0.1; ...@@ -602,14 +615,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]) {
...@@ -711,14 +731,22 @@ float junction_deviation = 0.1; ...@@ -711,14 +731,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 + extruder]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0; delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS + extruder]) * 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) {
...@@ -727,11 +755,12 @@ float junction_deviation = 0.1; ...@@ -727,11 +755,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
......
...@@ -350,34 +350,38 @@ FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) { ...@@ -350,34 +350,38 @@ 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;
} }
else { else {
X_APPLY_DIR(!INVERT_X_DIR,0); X_APPLY_DIR(!INVERT_X_DIR, 0);
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;
} }
else { else {
Y_APPLY_DIR(!INVERT_Y_DIR,0); Y_APPLY_DIR(!INVERT_Y_DIR, 0);
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;
} }
else { else {
Z_APPLY_DIR(!INVERT_Z_DIR,0); Z_APPLY_DIR(!INVERT_Z_DIR, 0);
count_direction[Z_AXIS] = 1; count_direction[Z_AXIS] = 1;
} }
...@@ -513,6 +517,11 @@ ISR(TIMER1_COMPA_vect) { ...@@ -513,6 +517,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
...@@ -538,8 +547,11 @@ ISR(TIMER1_COMPA_vect) { ...@@ -538,8 +547,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))) {
...@@ -560,7 +572,16 @@ ISR(TIMER1_COMPA_vect) { ...@@ -560,7 +572,16 @@ ISR(TIMER1_COMPA_vect) {
#ifdef COREXY #ifdef COREXY
} }
#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
...@@ -624,6 +645,9 @@ ISR(TIMER1_COMPA_vect) { ...@@ -624,6 +645,9 @@ ISR(TIMER1_COMPA_vect) {
} }
old_endstop_bits = current_endstop_bits; old_endstop_bits = current_endstop_bits;
#ifdef COREXZ
}
#endif
} }
#ifdef ENABLE_HIGH_SPEED_STEPPING #ifdef ENABLE_HIGH_SPEED_STEPPING
...@@ -664,6 +688,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -664,6 +688,7 @@ ISR(TIMER1_COMPA_vect) {
#endif #endif
step_events_completed++; step_events_completed++;
#endif #endif
// Calculate new timer value // Calculate new timer value
unsigned short timer; unsigned short timer;
unsigned short step_rate; unsigned short step_rate;
......
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