From aa65fe22ede12642b64c131f53a21e758291547f Mon Sep 17 00:00:00 2001 From: Erik van der Zalm Date: Sat, 14 Jul 2012 13:43:19 +0200 Subject: [PATCH] decoupled axes sucessfully at least on pure x or y jog --- Marlin/Configuration.h | 10 +++- Marlin/stepper.cpp | 130 ++++++++++++++++++++++++++++++++++------- 2 files changed, 115 insertions(+), 25 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index d4032a39f..b9bf13e33 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -35,6 +35,10 @@ #define MOTHERBOARD 7 #endif +/// Comment out the following line to enable normal kinematics + +#define COREXY + //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== @@ -168,7 +172,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th #define DISABLE_E false // For all extruders #define INVERT_X_DIR true // for Mendel set to false, for Orca set to true -#define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false +#define INVERT_Y_DIR true // for Mendel set to true, for Orca set to false #define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true #define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false #define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false @@ -180,8 +184,8 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true //If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true //If true, axis won't move to coordinates greater than the defined lengths below. +#define min_software_endstops false //If true, axis won't move to coordinates less than HOME_POS. +#define max_software_endstops false //If true, axis won't move to coordinates greater than the defined lengths below. #define X_MAX_LENGTH 205 #define Y_MAX_LENGTH 205 #define Z_MAX_LENGTH 200 diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 08ed8edd9..592e93007 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -214,6 +214,12 @@ void st_wake_up() { ENABLE_STEPPER_DRIVER_INTERRUPT(); } +void step_wait(){ + for(int8_t i=0; i < 6; i++){ + } +} + + FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) { unsigned short timer; if(step_rate > MAX_STEP_FREQUENCY) step_rate = MAX_STEP_FREQUENCY; @@ -317,8 +323,10 @@ ISR(TIMER1_COMPA_vect) out_bits = current_block->direction_bits; // Set direction en check limit switches - if ((out_bits & (1<steps_x >= current_block->steps_y)&&((out_bits & (1<steps_x >= current_block->steps_y)&&((out_bits & (1<steps_y > current_block->steps_x)&&((out_bits & (1<steps_y > current_block->steps_x)&&((out_bits & (1<steps_x; - if (counter_x > 0) { - WRITE(X_STEP_PIN, HIGH); - counter_x -= current_block->step_event_count; - WRITE(X_STEP_PIN, LOW); - count_position[X_AXIS]+=count_direction[X_AXIS]; - } - counter_y += current_block->steps_y; - if (counter_y > 0) { - WRITE(Y_STEP_PIN, HIGH); - counter_y -= current_block->step_event_count; - WRITE(Y_STEP_PIN, LOW); - count_position[Y_AXIS]+=count_direction[Y_AXIS]; - } + #if !defined COREXY + counter_x += current_block->steps_x; + if (counter_x > 0) { + WRITE(X_STEP_PIN, HIGH); + counter_x -= current_block->step_event_count; + WRITE(X_STEP_PIN, LOW); + count_position[X_AXIS]+=count_direction[X_AXIS]; + } + + counter_y += current_block->steps_y; + if (counter_y > 0) { + WRITE(Y_STEP_PIN, HIGH); + WRITE(Y_STEP_PIN, LOW); + + } + #endif + + #ifdef COREXY + counter_x += current_block->steps_x; + counter_y += current_block->steps_y; + + if ((counter_x > 0)&&!(counter_y>0)){ //X step only + WRITE(X_STEP_PIN, HIGH); + WRITE(Y_STEP_PIN, HIGH); + counter_x -= current_block->step_event_count; + WRITE(X_STEP_PIN, LOW); + WRITE(Y_STEP_PIN, LOW); + count_position[X_AXIS]+=count_direction[X_AXIS]; + } + + if (!(counter_x > 0)&&(counter_y>0)){ //Y step only + WRITE(X_STEP_PIN, HIGH); + WRITE(Y_STEP_PIN, HIGH); + counter_y -= current_block->step_event_count; + WRITE(X_STEP_PIN, LOW); + WRITE(Y_STEP_PIN, LOW); + count_position[Y_AXIS]+=count_direction[Y_AXIS]; + } + + if ((counter_x > 0)&&(counter_y>0)){ //step in both axes + if (((out_bits & (1<step_event_count; + WRITE(Y_STEP_PIN, LOW); + step_wait(); + count_position[X_AXIS]+=count_direction[X_AXIS]; + count_position[Y_AXIS]+=count_direction[Y_AXIS]; + WRITE(Y_STEP_PIN, HIGH); + counter_y -= current_block->step_event_count; + WRITE(Y_STEP_PIN, LOW); + } + else{ //X and Y in same direction + WRITE(X_STEP_PIN, HIGH); + counter_x -= current_block->step_event_count; + WRITE(X_STEP_PIN, LOW) ; + step_wait(); + count_position[X_AXIS]+=count_direction[X_AXIS]; + count_position[Y_AXIS]+=count_direction[Y_AXIS]; + WRITE(X_STEP_PIN, HIGH); + counter_y -= current_block->step_event_count; + WRITE(X_STEP_PIN, LOW); + } + } + #endif //corexy + counter_z += current_block->steps_z; if (counter_z > 0) { WRITE(Z_STEP_PIN, HIGH);