Merge pull request #1554 from 2PrintBeta/Development
Macro indirection for stepper drivers + Support for TMC26X and L6470 Stepper Drivers
This commit is contained in:
@ -462,6 +462,141 @@ const unsigned int dropsegments=5; //everything with less than this number of st
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************\
|
||||
* enable this section if you have TMC26X motor drivers.
|
||||
* you need to import the TMC26XStepper library into the arduino IDE for this
|
||||
******************************************************************************/
|
||||
|
||||
//#define HAVE_TMCDRIVER
|
||||
#ifdef HAVE_TMCDRIVER
|
||||
|
||||
// #define X_IS_TMC
|
||||
#define X_MAX_CURRENT 1000 //in mA
|
||||
#define X_SENSE_RESISTOR 91 //in mOhms
|
||||
#define X_MICROSTEPS 16 //number of microsteps
|
||||
|
||||
// #define X2_IS_TMC
|
||||
#define X2_MAX_CURRENT 1000 //in mA
|
||||
#define X2_SENSE_RESISTOR 91 //in mOhms
|
||||
#define X2_MICROSTEPS 16 //number of microsteps
|
||||
|
||||
// #define Y_IS_TMC
|
||||
#define Y_MAX_CURRENT 1000 //in mA
|
||||
#define Y_SENSE_RESISTOR 91 //in mOhms
|
||||
#define Y_MICROSTEPS 16 //number of microsteps
|
||||
|
||||
// #define Y2_IS_TMC
|
||||
#define Y2_MAX_CURRENT 1000 //in mA
|
||||
#define Y2_SENSE_RESISTOR 91 //in mOhms
|
||||
#define Y2_MICROSTEPS 16 //number of microsteps
|
||||
|
||||
// #define Z_IS_TMC
|
||||
#define Z_MAX_CURRENT 1000 //in mA
|
||||
#define Z_SENSE_RESISTOR 91 //in mOhms
|
||||
#define Z_MICROSTEPS 16 //number of microsteps
|
||||
|
||||
// #define Z2_IS_TMC
|
||||
#define Z2_MAX_CURRENT 1000 //in mA
|
||||
#define Z2_SENSE_RESISTOR 91 //in mOhms
|
||||
#define Z2_MICROSTEPS 16 //number of microsteps
|
||||
|
||||
// #define E0_IS_TMC
|
||||
#define E0_MAX_CURRENT 1000 //in mA
|
||||
#define E0_SENSE_RESISTOR 91 //in mOhms
|
||||
#define E0_MICROSTEPS 16 //number of microsteps
|
||||
|
||||
// #define E1_IS_TMC
|
||||
#define E1_MAX_CURRENT 1000 //in mA
|
||||
#define E1_SENSE_RESISTOR 91 //in mOhms
|
||||
#define E1_MICROSTEPS 16 //number of microsteps
|
||||
|
||||
// #define E2_IS_TMC
|
||||
#define E2_MAX_CURRENT 1000 //in mA
|
||||
#define E2_SENSE_RESISTOR 91 //in mOhms
|
||||
#define E2_MICROSTEPS 16 //number of microsteps
|
||||
|
||||
// #define E3_IS_TMC
|
||||
#define E3_MAX_CURRENT 1000 //in mA
|
||||
#define E3_SENSE_RESISTOR 91 //in mOhms
|
||||
#define E3_MICROSTEPS 16 //number of microsteps
|
||||
|
||||
#endif
|
||||
|
||||
/******************************************************************************\
|
||||
* enable this section if you have L6470 motor drivers.
|
||||
* you need to import the L6470 library into the arduino IDE for this
|
||||
******************************************************************************/
|
||||
|
||||
//#define HAVE_L6470DRIVER
|
||||
#ifdef HAVE_L6470DRIVER
|
||||
|
||||
// #define X_IS_L6470
|
||||
#define X_MICROSTEPS 16 //number of microsteps
|
||||
#define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
|
||||
#define X_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
|
||||
#define X_STALLCURRENT 1500 //current in mA where the driver will detect a stall
|
||||
|
||||
// #define X2_IS_L6470
|
||||
#define X2_MICROSTEPS 16 //number of microsteps
|
||||
#define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
|
||||
#define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
|
||||
#define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
|
||||
|
||||
// #define Y_IS_L6470
|
||||
#define Y_MICROSTEPS 16 //number of microsteps
|
||||
#define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
|
||||
#define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
|
||||
#define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall
|
||||
|
||||
// #define Y2_IS_L6470
|
||||
#define Y2_MICROSTEPS 16 //number of microsteps
|
||||
#define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
|
||||
#define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
|
||||
#define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
|
||||
|
||||
// #define Z_IS_L6470
|
||||
#define Z_MICROSTEPS 16 //number of microsteps
|
||||
#define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
|
||||
#define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
|
||||
#define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall
|
||||
|
||||
// #define Z2_IS_L6470
|
||||
#define Z2_MICROSTEPS 16 //number of microsteps
|
||||
#define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
|
||||
#define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
|
||||
#define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
|
||||
|
||||
// #define E0_IS_L6470
|
||||
#define E0_MICROSTEPS 16 //number of microsteps
|
||||
#define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
|
||||
#define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
|
||||
#define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall
|
||||
|
||||
// #define E1_IS_L6470
|
||||
#define E1_MICROSTEPS 16 //number of microsteps
|
||||
#define E1_MICROSTEPS 16 //number of microsteps
|
||||
#define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
|
||||
#define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
|
||||
#define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall
|
||||
|
||||
// #define E2_IS_L6470
|
||||
#define E2_MICROSTEPS 16 //number of microsteps
|
||||
#define E2_MICROSTEPS 16 //number of microsteps
|
||||
#define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
|
||||
#define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
|
||||
#define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
|
||||
|
||||
// #define E3_IS_L6470
|
||||
#define E3_MICROSTEPS 16 //number of microsteps
|
||||
#define E3_MICROSTEPS 16 //number of microsteps
|
||||
#define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
|
||||
#define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
|
||||
#define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//============================= Define Defines ============================
|
||||
//===========================================================================
|
||||
|
@ -112,11 +112,11 @@ void manage_inactivity(bool ignore_stepper_queue=false);
|
||||
|
||||
#if defined(DUAL_X_CARRIAGE) && defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1 \
|
||||
&& defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
|
||||
#define enable_x() do { WRITE(X_ENABLE_PIN, X_ENABLE_ON); WRITE(X2_ENABLE_PIN, X_ENABLE_ON); } while (0)
|
||||
#define disable_x() do { WRITE(X_ENABLE_PIN,!X_ENABLE_ON); WRITE(X2_ENABLE_PIN,!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } while (0)
|
||||
#define enable_x() do { X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); } while (0)
|
||||
#define disable_x() do { X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } while (0)
|
||||
#elif defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
|
||||
#define enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
|
||||
#define disable_x() { WRITE(X_ENABLE_PIN,!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }
|
||||
#define enable_x() X_ENABLE_WRITE( X_ENABLE_ON)
|
||||
#define disable_x() { X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }
|
||||
#else
|
||||
#define enable_x() ;
|
||||
#define disable_x() ;
|
||||
@ -124,11 +124,11 @@ void manage_inactivity(bool ignore_stepper_queue=false);
|
||||
|
||||
#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
|
||||
#ifdef Y_DUAL_STEPPER_DRIVERS
|
||||
#define enable_y() { WRITE(Y_ENABLE_PIN, Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, Y_ENABLE_ON); }
|
||||
#define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, !Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
|
||||
#define enable_y() { Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }
|
||||
#define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
|
||||
#else
|
||||
#define enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
|
||||
#define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
|
||||
#define enable_y() Y_ENABLE_WRITE( Y_ENABLE_ON)
|
||||
#define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
|
||||
#endif
|
||||
#else
|
||||
#define enable_y() ;
|
||||
@ -137,11 +137,11 @@ void manage_inactivity(bool ignore_stepper_queue=false);
|
||||
|
||||
#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
|
||||
#ifdef Z_DUAL_STEPPER_DRIVERS
|
||||
#define enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
|
||||
#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
|
||||
#define enable_z() { Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }
|
||||
#define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
|
||||
#else
|
||||
#define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
|
||||
#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
|
||||
#define enable_z() Z_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
|
||||
#endif
|
||||
#else
|
||||
#define enable_z() ;
|
||||
@ -149,32 +149,32 @@ void manage_inactivity(bool ignore_stepper_queue=false);
|
||||
#endif
|
||||
|
||||
#if defined(E0_ENABLE_PIN) && (E0_ENABLE_PIN > -1)
|
||||
#define enable_e0() WRITE(E0_ENABLE_PIN, E_ENABLE_ON)
|
||||
#define disable_e0() WRITE(E0_ENABLE_PIN,!E_ENABLE_ON)
|
||||
#define enable_e0() E0_ENABLE_WRITE(E_ENABLE_ON)
|
||||
#define disable_e0() E0_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define enable_e0() /* nothing */
|
||||
#define disable_e0() /* nothing */
|
||||
#endif
|
||||
|
||||
#if (EXTRUDERS > 1) && defined(E1_ENABLE_PIN) && (E1_ENABLE_PIN > -1)
|
||||
#define enable_e1() WRITE(E1_ENABLE_PIN, E_ENABLE_ON)
|
||||
#define disable_e1() WRITE(E1_ENABLE_PIN,!E_ENABLE_ON)
|
||||
#define enable_e1() E1_ENABLE_WRITE(E_ENABLE_ON)
|
||||
#define disable_e1() E1_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define enable_e1() /* nothing */
|
||||
#define disable_e1() /* nothing */
|
||||
#endif
|
||||
|
||||
#if (EXTRUDERS > 2) && defined(E2_ENABLE_PIN) && (E2_ENABLE_PIN > -1)
|
||||
#define enable_e2() WRITE(E2_ENABLE_PIN, E_ENABLE_ON)
|
||||
#define disable_e2() WRITE(E2_ENABLE_PIN,!E_ENABLE_ON)
|
||||
#define enable_e2() E2_ENABLE_WRITE(E_ENABLE_ON)
|
||||
#define disable_e2() E2_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define enable_e2() /* nothing */
|
||||
#define disable_e2() /* nothing */
|
||||
#endif
|
||||
|
||||
#if (EXTRUDERS > 3) && defined(E3_ENABLE_PIN) && (E3_ENABLE_PIN > -1)
|
||||
#define enable_e3() WRITE(E3_ENABLE_PIN, E_ENABLE_ON)
|
||||
#define disable_e3() WRITE(E3_ENABLE_PIN,!E_ENABLE_ON)
|
||||
#define enable_e3() E3_ENABLE_WRITE(E_ENABLE_ON)
|
||||
#define disable_e3() E3_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define enable_e3() /* nothing */
|
||||
#define disable_e3() /* nothing */
|
||||
|
@ -54,3 +54,13 @@
|
||||
#if defined(DIGIPOT_I2C)
|
||||
#include <Wire.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TMCDRIVER
|
||||
#include <SPI.h>
|
||||
#include <TMC26XStepper.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_L6470DRIVER
|
||||
#include <SPI.h>
|
||||
#include <L6470.h>
|
||||
#endif
|
||||
|
@ -5120,17 +5120,17 @@ void controllerFan()
|
||||
{
|
||||
lastMotorCheck = millis();
|
||||
|
||||
if((READ(X_ENABLE_PIN) == (X_ENABLE_ON)) || (READ(Y_ENABLE_PIN) == (Y_ENABLE_ON)) || (READ(Z_ENABLE_PIN) == (Z_ENABLE_ON)) || (soft_pwm_bed > 0)
|
||||
if((X_ENABLE_READ) == (X_ENABLE_ON)) || (Y_ENABLE_READ) == (Y_ENABLE_ON)) || (Z_ENABLE_READ) == (Z_ENABLE_ON)) || (soft_pwm_bed > 0)
|
||||
#if EXTRUDERS > 2
|
||||
|| (READ(E2_ENABLE_PIN) == (E_ENABLE_ON))
|
||||
|| (E2_ENABLE_READ) == (E_ENABLE_ON))
|
||||
#endif
|
||||
#if EXTRUDER > 1
|
||||
#if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
|
||||
|| (READ(X2_ENABLE_PIN) == (X_ENABLE_ON))
|
||||
|| (X2_ENABLE_READ) == (X_ENABLE_ON))
|
||||
#endif
|
||||
|| (READ(E1_ENABLE_PIN) == (E_ENABLE_ON))
|
||||
|| (E1_ENABLE_READ) == (E_ENABLE_ON))
|
||||
#endif
|
||||
|| (READ(E0_ENABLE_PIN) == (E_ENABLE_ON))) //If any of the drivers are enabled...
|
||||
|| (E0_ENABLE_READ) == (E_ENABLE_ON))) //If any of the drivers are enabled...
|
||||
{
|
||||
lastMotor = millis(); //... set time to NOW so the fan will turn on
|
||||
}
|
||||
@ -5355,7 +5355,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
|
||||
if( (millis() - previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 )
|
||||
if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)
|
||||
{
|
||||
bool oldstatus=READ(E0_ENABLE_PIN);
|
||||
bool oldstatus=E0_ENABLE_READ;
|
||||
enable_e0();
|
||||
float oldepos=current_position[E_AXIS];
|
||||
float oldedes=destination[E_AXIS];
|
||||
@ -5367,7 +5367,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
|
||||
plan_set_e_position(oldepos);
|
||||
previous_millis_cmd=millis();
|
||||
st_synchronize();
|
||||
WRITE(E0_ENABLE_PIN,oldstatus);
|
||||
E0_ENABLE_WRITE(oldstatus);
|
||||
}
|
||||
#endif
|
||||
#if defined(DUAL_X_CARRIAGE)
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <SPI.h>
|
||||
#endif
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//=============================public variables ============================
|
||||
//===========================================================================
|
||||
@ -88,6 +87,7 @@ static bool check_endstops = true;
|
||||
volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0};
|
||||
volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1};
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//=============================functions ============================
|
||||
//===========================================================================
|
||||
@ -349,51 +349,51 @@ ISR(TIMER1_COMPA_vect)
|
||||
if((out_bits & (1<<X_AXIS))!=0){
|
||||
#ifdef DUAL_X_CARRIAGE
|
||||
if (extruder_duplication_enabled){
|
||||
WRITE(X_DIR_PIN, INVERT_X_DIR);
|
||||
WRITE(X2_DIR_PIN, INVERT_X_DIR);
|
||||
X_DIR_WRITE(INVERT_X_DIR);
|
||||
X2_DIR_WRITE(INVERT_X_DIR);
|
||||
}
|
||||
else{
|
||||
if (current_block->active_extruder != 0)
|
||||
WRITE(X2_DIR_PIN, INVERT_X_DIR);
|
||||
X2_DIR_WRITE(INVERT_X_DIR);
|
||||
else
|
||||
WRITE(X_DIR_PIN, INVERT_X_DIR);
|
||||
X_DIR_WRITE(INVERT_X_DIR);
|
||||
}
|
||||
#else
|
||||
WRITE(X_DIR_PIN, INVERT_X_DIR);
|
||||
X_DIR_WRITE(INVERT_X_DIR);
|
||||
#endif
|
||||
count_direction[X_AXIS]=-1;
|
||||
}
|
||||
else{
|
||||
#ifdef DUAL_X_CARRIAGE
|
||||
if (extruder_duplication_enabled){
|
||||
WRITE(X_DIR_PIN, !INVERT_X_DIR);
|
||||
WRITE(X2_DIR_PIN, !INVERT_X_DIR);
|
||||
X_DIR_WRITE(!INVERT_X_DIR);
|
||||
X2_DIR_WRITE( !INVERT_X_DIR);
|
||||
}
|
||||
else{
|
||||
if (current_block->active_extruder != 0)
|
||||
WRITE(X2_DIR_PIN, !INVERT_X_DIR);
|
||||
X2_DIR_WRITE(!INVERT_X_DIR);
|
||||
else
|
||||
WRITE(X_DIR_PIN, !INVERT_X_DIR);
|
||||
X_DIR_WRITE(!INVERT_X_DIR);
|
||||
}
|
||||
#else
|
||||
WRITE(X_DIR_PIN, !INVERT_X_DIR);
|
||||
X_DIR_WRITE(!INVERT_X_DIR);
|
||||
#endif
|
||||
count_direction[X_AXIS]=1;
|
||||
}
|
||||
if((out_bits & (1<<Y_AXIS))!=0){
|
||||
WRITE(Y_DIR_PIN, INVERT_Y_DIR);
|
||||
Y_DIR_WRITE(INVERT_Y_DIR);
|
||||
|
||||
#ifdef Y_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Y2_DIR_PIN, !(INVERT_Y_DIR == INVERT_Y2_VS_Y_DIR));
|
||||
Y2_DIR_WRITE(!(INVERT_Y_DIR == INVERT_Y2_VS_Y_DIR));
|
||||
#endif
|
||||
|
||||
count_direction[Y_AXIS]=-1;
|
||||
}
|
||||
else{
|
||||
WRITE(Y_DIR_PIN, !INVERT_Y_DIR);
|
||||
Y_DIR_WRITE(!INVERT_Y_DIR);
|
||||
|
||||
#ifdef Y_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Y2_DIR_PIN, (INVERT_Y_DIR == INVERT_Y2_VS_Y_DIR));
|
||||
Y2_DIR_WRITE((INVERT_Y_DIR == INVERT_Y2_VS_Y_DIR));
|
||||
#endif
|
||||
|
||||
count_direction[Y_AXIS]=1;
|
||||
@ -480,10 +480,10 @@ ISR(TIMER1_COMPA_vect)
|
||||
}
|
||||
|
||||
if ((out_bits & (1<<Z_AXIS)) != 0) { // -direction
|
||||
WRITE(Z_DIR_PIN,INVERT_Z_DIR);
|
||||
Z_DIR_WRITE(INVERT_Z_DIR);
|
||||
|
||||
#ifdef Z_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Z2_DIR_PIN,INVERT_Z_DIR);
|
||||
Z2_DIR_WRITE(INVERT_Z_DIR);
|
||||
#endif
|
||||
|
||||
count_direction[Z_AXIS]=-1;
|
||||
@ -501,10 +501,10 @@ ISR(TIMER1_COMPA_vect)
|
||||
}
|
||||
}
|
||||
else { // +direction
|
||||
WRITE(Z_DIR_PIN,!INVERT_Z_DIR);
|
||||
Z_DIR_WRITE(!INVERT_Z_DIR);
|
||||
|
||||
#ifdef Z_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Z2_DIR_PIN,!INVERT_Z_DIR);
|
||||
Z2_DIR_WRITE(!INVERT_Z_DIR);
|
||||
#endif
|
||||
|
||||
count_direction[Z_AXIS]=1;
|
||||
@ -561,13 +561,13 @@ ISR(TIMER1_COMPA_vect)
|
||||
* instead of doing each in turn. The extra tests add enough
|
||||
* lag to allow it work with without needing NOPs
|
||||
*/
|
||||
if (counter_x > 0) WRITE(X_STEP_PIN, HIGH);
|
||||
if (counter_x > 0) X_STEP_WRITE(HIGH);
|
||||
|
||||
counter_y += current_block->steps_y;
|
||||
if (counter_y > 0) WRITE(Y_STEP_PIN, HIGH);
|
||||
if (counter_y > 0) Y_STEP_WRITE(HIGH);
|
||||
|
||||
counter_z += current_block->steps_z;
|
||||
if (counter_z > 0) WRITE(Z_STEP_PIN, HIGH);
|
||||
if (counter_z > 0) Z_STEP_WRITE(HIGH);
|
||||
|
||||
#ifndef ADVANCE
|
||||
counter_e += current_block->steps_e;
|
||||
@ -577,19 +577,19 @@ ISR(TIMER1_COMPA_vect)
|
||||
if (counter_x > 0) {
|
||||
counter_x -= current_block->step_event_count;
|
||||
count_position[X_AXIS] += count_direction[X_AXIS];
|
||||
WRITE(X_STEP_PIN, LOW);
|
||||
X_STEP_WRITE(LOW);
|
||||
}
|
||||
|
||||
if (counter_y > 0) {
|
||||
counter_y -= current_block->step_event_count;
|
||||
count_position[Y_AXIS] += count_direction[Y_AXIS];
|
||||
WRITE(Y_STEP_PIN, LOW);
|
||||
Y_STEP_WRITE( LOW);
|
||||
}
|
||||
|
||||
if (counter_z > 0) {
|
||||
counter_z -= current_block->step_event_count;
|
||||
count_position[Z_AXIS] += count_direction[Z_AXIS];
|
||||
WRITE(Z_STEP_PIN, LOW);
|
||||
Z_STEP_WRITE(LOW);
|
||||
}
|
||||
|
||||
#ifndef ADVANCE
|
||||
@ -603,66 +603,66 @@ ISR(TIMER1_COMPA_vect)
|
||||
if (counter_x > 0) {
|
||||
#ifdef DUAL_X_CARRIAGE
|
||||
if (extruder_duplication_enabled){
|
||||
WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
|
||||
WRITE(X2_STEP_PIN, !INVERT_X_STEP_PIN);
|
||||
X_STEP_WRITE(!INVERT_X_STEP_PIN);
|
||||
X2_STEP_WRITE( !INVERT_X_STEP_PIN);
|
||||
}
|
||||
else {
|
||||
if (current_block->active_extruder != 0)
|
||||
WRITE(X2_STEP_PIN, !INVERT_X_STEP_PIN);
|
||||
X2_STEP_WRITE( !INVERT_X_STEP_PIN);
|
||||
else
|
||||
WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
|
||||
X_STEP_WRITE(!INVERT_X_STEP_PIN);
|
||||
}
|
||||
#else
|
||||
WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
|
||||
X_STEP_WRITE(!INVERT_X_STEP_PIN);
|
||||
#endif
|
||||
counter_x -= current_block->step_event_count;
|
||||
count_position[X_AXIS] += count_direction[X_AXIS];
|
||||
#ifdef DUAL_X_CARRIAGE
|
||||
if (extruder_duplication_enabled){
|
||||
WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
|
||||
WRITE(X2_STEP_PIN, INVERT_X_STEP_PIN);
|
||||
X_STEP_WRITE(INVERT_X_STEP_PIN);
|
||||
X2_STEP_WRITE(INVERT_X_STEP_PIN);
|
||||
}
|
||||
else {
|
||||
if (current_block->active_extruder != 0)
|
||||
WRITE(X2_STEP_PIN, INVERT_X_STEP_PIN);
|
||||
X2_STEP_WRITE(INVERT_X_STEP_PIN);
|
||||
else
|
||||
WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
|
||||
X_STEP_WRITE(INVERT_X_STEP_PIN);
|
||||
}
|
||||
#else
|
||||
WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
|
||||
X_STEP_WRITE(INVERT_X_STEP_PIN);
|
||||
#endif
|
||||
}
|
||||
|
||||
counter_y += current_block->steps_y;
|
||||
if (counter_y > 0) {
|
||||
WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
|
||||
Y_STEP_WRITE(!INVERT_Y_STEP_PIN);
|
||||
|
||||
#ifdef Y_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Y2_STEP_PIN, !INVERT_Y_STEP_PIN);
|
||||
Y2_STEP_WRITE( !INVERT_Y_STEP_PIN);
|
||||
#endif
|
||||
|
||||
counter_y -= current_block->step_event_count;
|
||||
count_position[Y_AXIS] += count_direction[Y_AXIS];
|
||||
WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
|
||||
Y_STEP_WRITE(INVERT_Y_STEP_PIN);
|
||||
|
||||
#ifdef Y_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Y2_STEP_PIN, INVERT_Y_STEP_PIN);
|
||||
Y2_STEP_WRITE( INVERT_Y_STEP_PIN);
|
||||
#endif
|
||||
}
|
||||
|
||||
counter_z += current_block->steps_z;
|
||||
if (counter_z > 0) {
|
||||
WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
|
||||
Z_STEP_WRITE( !INVERT_Z_STEP_PIN);
|
||||
#ifdef Z_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Z2_STEP_PIN, !INVERT_Z_STEP_PIN);
|
||||
Z2_STEP_WRITE(!INVERT_Z_STEP_PIN);
|
||||
#endif
|
||||
|
||||
counter_z -= current_block->step_event_count;
|
||||
count_position[Z_AXIS] += count_direction[Z_AXIS];
|
||||
WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN);
|
||||
Z_STEP_WRITE( INVERT_Z_STEP_PIN);
|
||||
|
||||
#ifdef Z_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Z2_STEP_PIN, INVERT_Z_STEP_PIN);
|
||||
Z2_STEP_WRITE(INVERT_Z_STEP_PIN);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -759,60 +759,60 @@ ISR(TIMER1_COMPA_vect)
|
||||
// Set E direction (Depends on E direction + advance)
|
||||
for(unsigned char i=0; i<4;i++) {
|
||||
if (e_steps[0] != 0) {
|
||||
WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN);
|
||||
E0_STEP_WRITE( INVERT_E_STEP_PIN);
|
||||
if (e_steps[0] < 0) {
|
||||
WRITE(E0_DIR_PIN, INVERT_E0_DIR);
|
||||
E0_DIR_WRITE(INVERT_E0_DIR);
|
||||
e_steps[0]++;
|
||||
WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN);
|
||||
E0_STEP_WRITE(!INVERT_E_STEP_PIN);
|
||||
}
|
||||
else if (e_steps[0] > 0) {
|
||||
WRITE(E0_DIR_PIN, !INVERT_E0_DIR);
|
||||
E0_DIR_WRITE(!INVERT_E0_DIR);
|
||||
e_steps[0]--;
|
||||
WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN);
|
||||
E0_STEP_WRITE(!INVERT_E_STEP_PIN);
|
||||
}
|
||||
}
|
||||
#if EXTRUDERS > 1
|
||||
if (e_steps[1] != 0) {
|
||||
WRITE(E1_STEP_PIN, INVERT_E_STEP_PIN);
|
||||
E1_STEP_WRITE(INVERT_E_STEP_PIN);
|
||||
if (e_steps[1] < 0) {
|
||||
WRITE(E1_DIR_PIN, INVERT_E1_DIR);
|
||||
E1_DIR_WRITE(INVERT_E1_DIR);
|
||||
e_steps[1]++;
|
||||
WRITE(E1_STEP_PIN, !INVERT_E_STEP_PIN);
|
||||
E1_STEP_WRITE(!INVERT_E_STEP_PIN);
|
||||
}
|
||||
else if (e_steps[1] > 0) {
|
||||
WRITE(E1_DIR_PIN, !INVERT_E1_DIR);
|
||||
E1_DIR_WRITE(!INVERT_E1_DIR);
|
||||
e_steps[1]--;
|
||||
WRITE(E1_STEP_PIN, !INVERT_E_STEP_PIN);
|
||||
E1_STEP_WRITE(!INVERT_E_STEP_PIN);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if EXTRUDERS > 2
|
||||
if (e_steps[2] != 0) {
|
||||
WRITE(E2_STEP_PIN, INVERT_E_STEP_PIN);
|
||||
E2_STEP_WRITE(INVERT_E_STEP_PIN);
|
||||
if (e_steps[2] < 0) {
|
||||
WRITE(E2_DIR_PIN, INVERT_E2_DIR);
|
||||
E2_DIR_WRITE(INVERT_E2_DIR);
|
||||
e_steps[2]++;
|
||||
WRITE(E2_STEP_PIN, !INVERT_E_STEP_PIN);
|
||||
E2_STEP_WRITE(!INVERT_E_STEP_PIN);
|
||||
}
|
||||
else if (e_steps[2] > 0) {
|
||||
WRITE(E2_DIR_PIN, !INVERT_E2_DIR);
|
||||
E2_DIR_WRITE(!INVERT_E2_DIR);
|
||||
e_steps[2]--;
|
||||
WRITE(E2_STEP_PIN, !INVERT_E_STEP_PIN);
|
||||
E2_STEP_WRITE(!INVERT_E_STEP_PIN);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if EXTRUDERS > 3
|
||||
if (e_steps[3] != 0) {
|
||||
WRITE(E3_STEP_PIN, INVERT_E_STEP_PIN);
|
||||
E3_STEP_WRITE(INVERT_E_STEP_PIN);
|
||||
if (e_steps[3] < 0) {
|
||||
WRITE(E3_DIR_PIN, INVERT_E3_DIR);
|
||||
E3_DIR_WRITE(INVERT_E3_DIR);
|
||||
e_steps[3]++;
|
||||
WRITE(E3_STEP_PIN, !INVERT_E_STEP_PIN);
|
||||
E3_STEP_WRITE(!INVERT_E_STEP_PIN);
|
||||
}
|
||||
else if (e_steps[3] > 0) {
|
||||
WRITE(E3_DIR_PIN, !INVERT_E3_DIR);
|
||||
E3_DIR_WRITE(!INVERT_E3_DIR);
|
||||
e_steps[3]--;
|
||||
WRITE(E3_STEP_PIN, !INVERT_E_STEP_PIN);
|
||||
E3_STEP_WRITE(!INVERT_E_STEP_PIN);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -826,83 +826,93 @@ void st_init()
|
||||
digipot_init(); //Initialize Digipot Motor Current
|
||||
microstep_init(); //Initialize Microstepping Pins
|
||||
|
||||
// initialise TMC Steppers
|
||||
#ifdef HAVE_TMCDRIVER
|
||||
tmc_init();
|
||||
#endif
|
||||
// initialise L6470 Steppers
|
||||
#ifdef HAVE_L6470DRIVER
|
||||
L6470_init();
|
||||
#endif
|
||||
|
||||
|
||||
//Initialize Dir Pins
|
||||
#if defined(X_DIR_PIN) && X_DIR_PIN > -1
|
||||
SET_OUTPUT(X_DIR_PIN);
|
||||
X_DIR_INIT;
|
||||
#endif
|
||||
#if defined(X2_DIR_PIN) && X2_DIR_PIN > -1
|
||||
SET_OUTPUT(X2_DIR_PIN);
|
||||
X2_DIR_INIT;
|
||||
#endif
|
||||
#if defined(Y_DIR_PIN) && Y_DIR_PIN > -1
|
||||
SET_OUTPUT(Y_DIR_PIN);
|
||||
Y_DIR_INIT;
|
||||
|
||||
#if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_DIR_PIN) && (Y2_DIR_PIN > -1)
|
||||
SET_OUTPUT(Y2_DIR_PIN);
|
||||
Y2_DIR_INIT;
|
||||
#endif
|
||||
#endif
|
||||
#if defined(Z_DIR_PIN) && Z_DIR_PIN > -1
|
||||
SET_OUTPUT(Z_DIR_PIN);
|
||||
Z_DIR_INIT;
|
||||
|
||||
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_DIR_PIN) && (Z2_DIR_PIN > -1)
|
||||
SET_OUTPUT(Z2_DIR_PIN);
|
||||
Z2_DIR_INIT;
|
||||
#endif
|
||||
#endif
|
||||
#if defined(E0_DIR_PIN) && E0_DIR_PIN > -1
|
||||
SET_OUTPUT(E0_DIR_PIN);
|
||||
E0_DIR_INIT;
|
||||
#endif
|
||||
#if defined(E1_DIR_PIN) && (E1_DIR_PIN > -1)
|
||||
SET_OUTPUT(E1_DIR_PIN);
|
||||
E1_DIR_INIT;
|
||||
#endif
|
||||
#if defined(E2_DIR_PIN) && (E2_DIR_PIN > -1)
|
||||
SET_OUTPUT(E2_DIR_PIN);
|
||||
E2_DIR_INIT;
|
||||
#endif
|
||||
#if defined(E3_DIR_PIN) && (E3_DIR_PIN > -1)
|
||||
SET_OUTPUT(E3_DIR_PIN);
|
||||
E3_DIR_INIT;
|
||||
#endif
|
||||
|
||||
//Initialize Enable Pins - steppers default to disabled.
|
||||
|
||||
#if defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
|
||||
SET_OUTPUT(X_ENABLE_PIN);
|
||||
if(!X_ENABLE_ON) WRITE(X_ENABLE_PIN,HIGH);
|
||||
X_ENABLE_INIT;
|
||||
if(!X_ENABLE_ON) X_ENABLE_WRITE(HIGH);
|
||||
#endif
|
||||
#if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
|
||||
SET_OUTPUT(X2_ENABLE_PIN);
|
||||
if(!X_ENABLE_ON) WRITE(X2_ENABLE_PIN,HIGH);
|
||||
X2_ENABLE_INIT;
|
||||
if(!X_ENABLE_ON) X2_ENABLE_WRITE(HIGH);
|
||||
#endif
|
||||
#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
|
||||
SET_OUTPUT(Y_ENABLE_PIN);
|
||||
if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH);
|
||||
Y_ENABLE_INIT;
|
||||
if(!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH);
|
||||
|
||||
#if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_ENABLE_PIN) && (Y2_ENABLE_PIN > -1)
|
||||
SET_OUTPUT(Y2_ENABLE_PIN);
|
||||
if(!Y_ENABLE_ON) WRITE(Y2_ENABLE_PIN,HIGH);
|
||||
Y2_ENABLE_INIT;
|
||||
if(!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH);
|
||||
#endif
|
||||
#endif
|
||||
#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
|
||||
SET_OUTPUT(Z_ENABLE_PIN);
|
||||
if(!Z_ENABLE_ON) WRITE(Z_ENABLE_PIN,HIGH);
|
||||
Z_ENABLE_INIT;
|
||||
if(!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH);
|
||||
|
||||
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_ENABLE_PIN) && (Z2_ENABLE_PIN > -1)
|
||||
SET_OUTPUT(Z2_ENABLE_PIN);
|
||||
if(!Z_ENABLE_ON) WRITE(Z2_ENABLE_PIN,HIGH);
|
||||
Z2_ENABLE_INIT;
|
||||
if(!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH);
|
||||
#endif
|
||||
#endif
|
||||
#if defined(E0_ENABLE_PIN) && (E0_ENABLE_PIN > -1)
|
||||
SET_OUTPUT(E0_ENABLE_PIN);
|
||||
if(!E_ENABLE_ON) WRITE(E0_ENABLE_PIN,HIGH);
|
||||
E0_ENABLE_INIT;
|
||||
if(!E_ENABLE_ON) E0_ENABLE_WRITE(HIGH);
|
||||
#endif
|
||||
#if defined(E1_ENABLE_PIN) && (E1_ENABLE_PIN > -1)
|
||||
SET_OUTPUT(E1_ENABLE_PIN);
|
||||
if(!E_ENABLE_ON) WRITE(E1_ENABLE_PIN,HIGH);
|
||||
E1_ENABLE_INIT;
|
||||
if(!E_ENABLE_ON) E1_ENABLE_WRITE(HIGH);
|
||||
#endif
|
||||
#if defined(E2_ENABLE_PIN) && (E2_ENABLE_PIN > -1)
|
||||
SET_OUTPUT(E2_ENABLE_PIN);
|
||||
if(!E_ENABLE_ON) WRITE(E2_ENABLE_PIN,HIGH);
|
||||
E2_ENABLE_INIT;
|
||||
if(!E_ENABLE_ON) E2_ENABLE_WRITE(HIGH);
|
||||
#endif
|
||||
#if defined(E3_ENABLE_PIN) && (E3_ENABLE_PIN > -1)
|
||||
SET_OUTPUT(E3_ENABLE_PIN);
|
||||
if(!E_ENABLE_ON) WRITE(E3_ENABLE_PIN,HIGH);
|
||||
E3_ENABLE_INIT;
|
||||
if(!E_ENABLE_ON) E3_ENABLE_WRITE(HIGH);
|
||||
#endif
|
||||
|
||||
//endstops and pullups
|
||||
@ -952,41 +962,51 @@ void st_init()
|
||||
|
||||
//Initialize Step Pins
|
||||
#if defined(X_STEP_PIN) && (X_STEP_PIN > -1)
|
||||
OUT_WRITE(X_STEP_PIN,INVERT_X_STEP_PIN);
|
||||
X_STEP_INIT;
|
||||
X_STEP_WRITE(INVERT_X_STEP_PIN);
|
||||
disable_x();
|
||||
#endif
|
||||
#if defined(X2_STEP_PIN) && (X2_STEP_PIN > -1)
|
||||
OUT_WRITE(X2_STEP_PIN,INVERT_X_STEP_PIN);
|
||||
X2_STEP_INIT;
|
||||
X2_STEP_WRITE(INVERT_X_STEP_PIN);
|
||||
disable_x();
|
||||
#endif
|
||||
#if defined(Y_STEP_PIN) && (Y_STEP_PIN > -1)
|
||||
OUT_WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN);
|
||||
Y_STEP_INIT;
|
||||
Y_STEP_WRITE(INVERT_Y_STEP_PIN);
|
||||
#if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_STEP_PIN) && (Y2_STEP_PIN > -1)
|
||||
OUT_WRITE(Y2_STEP_PIN,INVERT_Y_STEP_PIN);
|
||||
Y2_STEP_INIT;
|
||||
Y2_STEP_WRITE(INVERT_Y_STEP_PIN);
|
||||
#endif
|
||||
disable_y();
|
||||
#endif
|
||||
#if defined(Z_STEP_PIN) && (Z_STEP_PIN > -1)
|
||||
OUT_WRITE(Z_STEP_PIN,INVERT_Z_STEP_PIN);
|
||||
Z_STEP_INIT;
|
||||
Z_STEP_WRITE(INVERT_Z_STEP_PIN);
|
||||
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_STEP_PIN) && (Z2_STEP_PIN > -1)
|
||||
OUT_WRITE(Z2_STEP_PIN,INVERT_Z_STEP_PIN);
|
||||
Z2_STEP_INIT;
|
||||
Z2_STEP_WRITE(INVERT_Z_STEP_PIN);
|
||||
#endif
|
||||
disable_z();
|
||||
#endif
|
||||
#if defined(E0_STEP_PIN) && (E0_STEP_PIN > -1)
|
||||
OUT_WRITE(E0_STEP_PIN,INVERT_E_STEP_PIN);
|
||||
E0_STEP_INIT;
|
||||
E0_STEP_WRITE(INVERT_E_STEP_PIN);
|
||||
disable_e0();
|
||||
#endif
|
||||
#if defined(E1_STEP_PIN) && (E1_STEP_PIN > -1)
|
||||
OUT_WRITE(E1_STEP_PIN,INVERT_E_STEP_PIN);
|
||||
E1_STEP_INIT;
|
||||
E1_STEP_WRITE(INVERT_E_STEP_PIN);
|
||||
disable_e1();
|
||||
#endif
|
||||
#if defined(E2_STEP_PIN) && (E2_STEP_PIN > -1)
|
||||
OUT_WRITE(E2_STEP_PIN,INVERT_E_STEP_PIN);
|
||||
E2_STEP_INIT;
|
||||
E2_STEP_WRITE(INVERT_E_STEP_PIN);
|
||||
disable_e2();
|
||||
#endif
|
||||
#if defined(E3_STEP_PIN) && (E3_STEP_PIN > -1)
|
||||
OUT_WRITE(E3_STEP_PIN,INVERT_E_STEP_PIN);
|
||||
E3_STEP_INIT;
|
||||
E3_STEP_WRITE(INVERT_E_STEP_PIN);
|
||||
disable_e3();
|
||||
#endif
|
||||
|
||||
@ -1105,31 +1125,31 @@ void babystep(const uint8_t axis,const bool direction)
|
||||
case X_AXIS:
|
||||
{
|
||||
enable_x();
|
||||
uint8_t old_x_dir_pin= READ(X_DIR_PIN); //if dualzstepper, both point to same direction.
|
||||
uint8_t old_x_dir_pin= X_DIR_READ; //if dualzstepper, both point to same direction.
|
||||
|
||||
//setup new step
|
||||
WRITE(X_DIR_PIN,(INVERT_X_DIR)^direction);
|
||||
X_DIR_WRITE((INVERT_X_DIR)^direction);
|
||||
#ifdef DUAL_X_CARRIAGE
|
||||
WRITE(X2_DIR_PIN,(INVERT_X_DIR)^direction);
|
||||
X2_DIR_WRITE((INVERT_X_DIR)^direction);
|
||||
#endif
|
||||
|
||||
//perform step
|
||||
WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
|
||||
X_STEP_WRITE(!INVERT_X_STEP_PIN);
|
||||
#ifdef DUAL_X_CARRIAGE
|
||||
WRITE(X2_STEP_PIN, !INVERT_X_STEP_PIN);
|
||||
X2_STEP_WRITE(!INVERT_X_STEP_PIN);
|
||||
#endif
|
||||
|
||||
_delay_us(1U); // wait 1 microsecond
|
||||
|
||||
WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
|
||||
X_STEP_WRITE(INVERT_X_STEP_PIN);
|
||||
#ifdef DUAL_X_CARRIAGE
|
||||
WRITE(X2_STEP_PIN, INVERT_X_STEP_PIN);
|
||||
X2_STEP_WRITE(INVERT_X_STEP_PIN);
|
||||
#endif
|
||||
|
||||
//get old pin state back.
|
||||
WRITE(X_DIR_PIN,old_x_dir_pin);
|
||||
X_DIR_WRITE(old_x_dir_pin);
|
||||
#ifdef DUAL_X_CARRIAGE
|
||||
WRITE(X2_DIR_PIN,old_x_dir_pin);
|
||||
X2_DIR_WRITE(old_x_dir_pin);
|
||||
#endif
|
||||
|
||||
}
|
||||
@ -1137,31 +1157,31 @@ void babystep(const uint8_t axis,const bool direction)
|
||||
case Y_AXIS:
|
||||
{
|
||||
enable_y();
|
||||
uint8_t old_y_dir_pin= READ(Y_DIR_PIN); //if dualzstepper, both point to same direction.
|
||||
uint8_t old_y_dir_pin= Y_DIR_READ; //if dualzstepper, both point to same direction.
|
||||
|
||||
//setup new step
|
||||
WRITE(Y_DIR_PIN,(INVERT_Y_DIR)^direction);
|
||||
Y_DIR_WRITE((INVERT_Y_DIR)^direction);
|
||||
#ifdef DUAL_Y_CARRIAGE
|
||||
WRITE(Y2_DIR_PIN,(INVERT_Y_DIR)^direction);
|
||||
Y2_DIR_WRITE((INVERT_Y_DIR)^direction);
|
||||
#endif
|
||||
|
||||
//perform step
|
||||
WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
|
||||
Y_STEP_WRITE(!INVERT_Y_STEP_PIN);
|
||||
#ifdef DUAL_Y_CARRIAGE
|
||||
WRITE(Y2_STEP_PIN, !INVERT_Y_STEP_PIN);
|
||||
Y2_STEP_WRITE( !INVERT_Y_STEP_PIN);
|
||||
#endif
|
||||
|
||||
_delay_us(1U); // wait 1 microsecond
|
||||
|
||||
WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
|
||||
Y_STEP_WRITE(INVERT_Y_STEP_PIN);
|
||||
#ifdef DUAL_Y_CARRIAGE
|
||||
WRITE(Y2_STEP_PIN, INVERT_Y_STEP_PIN);
|
||||
Y2_STEP_WRITE(INVERT_Y_STEP_PIN);
|
||||
#endif
|
||||
|
||||
//get old pin state back.
|
||||
WRITE(Y_DIR_PIN,old_y_dir_pin);
|
||||
Y_DIR_WRITE(old_y_dir_pin);
|
||||
#ifdef DUAL_Y_CARRIAGE
|
||||
WRITE(Y2_DIR_PIN,old_y_dir_pin);
|
||||
Y2_DIR_WRITE(old_y_dir_pin);
|
||||
#endif
|
||||
|
||||
}
|
||||
@ -1171,29 +1191,29 @@ void babystep(const uint8_t axis,const bool direction)
|
||||
case Z_AXIS:
|
||||
{
|
||||
enable_z();
|
||||
uint8_t old_z_dir_pin= READ(Z_DIR_PIN); //if dualzstepper, both point to same direction.
|
||||
uint8_t old_z_dir_pin= Z_DIR_READ; //if dualzstepper, both point to same direction.
|
||||
//setup new step
|
||||
WRITE(Z_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
|
||||
Z_DIR_WRITE((INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
|
||||
#ifdef Z_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Z2_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
|
||||
Z2_DIR_WRITE((INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
|
||||
#endif
|
||||
//perform step
|
||||
WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
|
||||
Z_STEP_WRITE(!INVERT_Z_STEP_PIN);
|
||||
#ifdef Z_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Z2_STEP_PIN, !INVERT_Z_STEP_PIN);
|
||||
Z2_STEP_WRITE( !INVERT_Z_STEP_PIN);
|
||||
#endif
|
||||
|
||||
_delay_us(1U); // wait 1 microsecond
|
||||
|
||||
WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN);
|
||||
Z_STEP_WRITE( INVERT_Z_STEP_PIN);
|
||||
#ifdef Z_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Z2_STEP_PIN, INVERT_Z_STEP_PIN);
|
||||
Z2_STEP_WRITE(INVERT_Z_STEP_PIN);
|
||||
#endif
|
||||
|
||||
//get old pin state back.
|
||||
WRITE(Z_DIR_PIN,old_z_dir_pin);
|
||||
Z_DIR_WRITE(old_z_dir_pin);
|
||||
#ifdef Z_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Z2_DIR_PIN,old_z_dir_pin);
|
||||
Z2_DIR_WRITE(old_z_dir_pin);
|
||||
#endif
|
||||
|
||||
}
|
||||
@ -1204,29 +1224,29 @@ void babystep(const uint8_t axis,const bool direction)
|
||||
enable_x();
|
||||
enable_y();
|
||||
enable_z();
|
||||
uint8_t old_x_dir_pin= READ(X_DIR_PIN);
|
||||
uint8_t old_y_dir_pin= READ(Y_DIR_PIN);
|
||||
uint8_t old_z_dir_pin= READ(Z_DIR_PIN);
|
||||
uint8_t old_x_dir_pin= X_DIR_READ;
|
||||
uint8_t old_y_dir_pin= Y_DIR_READ;
|
||||
uint8_t old_z_dir_pin= Z_DIR_READ;
|
||||
//setup new step
|
||||
WRITE(X_DIR_PIN,(INVERT_X_DIR)^direction^BABYSTEP_INVERT_Z);
|
||||
WRITE(Y_DIR_PIN,(INVERT_Y_DIR)^direction^BABYSTEP_INVERT_Z);
|
||||
WRITE(Z_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
|
||||
X_DIR_WRITE((INVERT_X_DIR)^direction^BABYSTEP_INVERT_Z);
|
||||
Y_DIR_WRITE((INVERT_Y_DIR)^direction^BABYSTEP_INVERT_Z);
|
||||
Z_DIR_WRITE((INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
|
||||
|
||||
//perform step
|
||||
WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
|
||||
WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
|
||||
WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
|
||||
X_STEP_WRITE( !INVERT_X_STEP_PIN);
|
||||
Y_STEP_WRITE(!INVERT_Y_STEP_PIN);
|
||||
Z_STEP_WRITE(!INVERT_Z_STEP_PIN);
|
||||
|
||||
_delay_us(1U); // wait 1 microsecond
|
||||
|
||||
WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
|
||||
WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
|
||||
WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN);
|
||||
X_STEP_WRITE(INVERT_X_STEP_PIN);
|
||||
Y_STEP_WRITE(INVERT_Y_STEP_PIN);
|
||||
Z_STEP_WRITE(INVERT_Z_STEP_PIN);
|
||||
|
||||
//get old pin state back.
|
||||
WRITE(X_DIR_PIN,old_x_dir_pin);
|
||||
WRITE(Y_DIR_PIN,old_y_dir_pin);
|
||||
WRITE(Z_DIR_PIN,old_z_dir_pin);
|
||||
X_DIR_WRITE(old_x_dir_pin);
|
||||
Y_DIR_WRITE(old_y_dir_pin);
|
||||
Z_DIR_WRITE(old_z_dir_pin);
|
||||
|
||||
}
|
||||
break;
|
||||
@ -1363,4 +1383,3 @@ void microstep_readings()
|
||||
SERIAL_PROTOCOLLN( digitalRead(E1_MS2_PIN));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -22,30 +22,31 @@
|
||||
#define stepper_h
|
||||
|
||||
#include "planner.h"
|
||||
#include "stepper_indirection.h"
|
||||
|
||||
#if EXTRUDERS > 3
|
||||
#define WRITE_E_STEP(v) { if(current_block->active_extruder == 3) { WRITE(E3_STEP_PIN, v); } else { if(current_block->active_extruder == 2) { WRITE(E2_STEP_PIN, v); } else { if(current_block->active_extruder == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}}}
|
||||
#define NORM_E_DIR() { if(current_block->active_extruder == 3) { WRITE(E3_DIR_PIN, !INVERT_E3_DIR); } else { if(current_block->active_extruder == 2) { WRITE(E2_DIR_PIN, !INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); }}}}
|
||||
#define REV_E_DIR() { if(current_block->active_extruder == 3) { WRITE(E3_DIR_PIN, INVERT_E3_DIR); } else { if(current_block->active_extruder == 2) { WRITE(E2_DIR_PIN, INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, INVERT_E0_DIR); }}}}
|
||||
#define WRITE_E_STEP(v) { if(current_block->active_extruder == 3) { E3_STEP_WRITE(v); } else { if(current_block->active_extruder == 2) { E2_STEP_WRITE(v); } else { if(current_block->active_extruder == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}}}
|
||||
#define NORM_E_DIR() { if(current_block->active_extruder == 3) { E3_DIR_WRITE( !INVERT_E3_DIR); } else { if(current_block->active_extruder == 2) { E2_DIR_WRITE(!INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}}}
|
||||
#define REV_E_DIR() { if(current_block->active_extruder == 3) { E3_DIR_WRITE(INVERT_E3_DIR); } else { if(current_block->active_extruder == 2) { E2_DIR_WRITE(INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}}}
|
||||
#elif EXTRUDERS > 2
|
||||
#define WRITE_E_STEP(v) { if(current_block->active_extruder == 2) { WRITE(E2_STEP_PIN, v); } else { if(current_block->active_extruder == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}}
|
||||
#define NORM_E_DIR() { if(current_block->active_extruder == 2) { WRITE(E2_DIR_PIN, !INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); }}}
|
||||
#define REV_E_DIR() { if(current_block->active_extruder == 2) { WRITE(E2_DIR_PIN, INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, INVERT_E0_DIR); }}}
|
||||
#define WRITE_E_STEP(v) { if(current_block->active_extruder == 2) { E2_STEP_WRITE(v); } else { if(current_block->active_extruder == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}}
|
||||
#define NORM_E_DIR() { if(current_block->active_extruder == 2) { E2_DIR_WRITE(!INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}}
|
||||
#define REV_E_DIR() { if(current_block->active_extruder == 2) { E2_DIR_WRITE(INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}}
|
||||
#elif EXTRUDERS > 1
|
||||
#ifndef DUAL_X_CARRIAGE
|
||||
#define WRITE_E_STEP(v) { if(current_block->active_extruder == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}
|
||||
#define NORM_E_DIR() { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); }}
|
||||
#define REV_E_DIR() { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, INVERT_E0_DIR); }}
|
||||
#define WRITE_E_STEP(v) { if(current_block->active_extruder == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}
|
||||
#define NORM_E_DIR() { if(current_block->active_extruder == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}
|
||||
#define REV_E_DIR() { if(current_block->active_extruder == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}
|
||||
#else
|
||||
extern bool extruder_duplication_enabled;
|
||||
#define WRITE_E_STEP(v) { if(extruder_duplication_enabled) { WRITE(E0_STEP_PIN, v); WRITE(E1_STEP_PIN, v); } else if(current_block->active_extruder == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}
|
||||
#define NORM_E_DIR() { if(extruder_duplication_enabled) { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); }}
|
||||
#define REV_E_DIR() { if(extruder_duplication_enabled) { WRITE(E0_DIR_PIN, INVERT_E0_DIR); WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, INVERT_E0_DIR); }}
|
||||
#define WRITE_E_STEP(v) { if(extruder_duplication_enabled) { E0_STEP_WRITE(v); E1_STEP_WRITE(v); } else if(current_block->active_extruder == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}
|
||||
#define NORM_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); } else if(current_block->active_extruder == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}
|
||||
#define REV_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE(INVERT_E0_DIR); E1_DIR_WRITE(INVERT_E1_DIR); } else if(current_block->active_extruder == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}
|
||||
#endif
|
||||
#else
|
||||
#define WRITE_E_STEP(v) WRITE(E0_STEP_PIN, v)
|
||||
#define NORM_E_DIR() WRITE(E0_DIR_PIN, !INVERT_E0_DIR)
|
||||
#define REV_E_DIR() WRITE(E0_DIR_PIN, INVERT_E0_DIR)
|
||||
#define WRITE_E_STEP(v) E0_STEP_WRITE(v)
|
||||
#define NORM_E_DIR() E0_DIR_WRITE(!INVERT_E0_DIR)
|
||||
#define REV_E_DIR() E0_DIR_WRITE(INVERT_E0_DIR)
|
||||
#endif
|
||||
|
||||
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
||||
@ -100,6 +101,4 @@ void microstep_readings();
|
||||
void babystep(const uint8_t axis,const bool direction); // perform a short step with a single stepper motor, outside of any convention
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
224
Marlin/stepper_indirection.cpp
Normal file
224
Marlin/stepper_indirection.cpp
Normal file
@ -0,0 +1,224 @@
|
||||
/*
|
||||
stepper_indirection.c - stepper motor driver indirection
|
||||
to allow some stepper functions to be done via SPI/I2c instead of direct pin manipulation
|
||||
Part of Marlin
|
||||
|
||||
Copyright (c) 2015 Dominik Wenger
|
||||
|
||||
Marlin is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Marlin is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Marlin. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stepper_indirection.h"
|
||||
#include "Configuration.h"
|
||||
|
||||
#ifdef HAVE_TMCDRIVER
|
||||
#include <SPI.h>
|
||||
#include <TMC26XStepper.h>
|
||||
#endif
|
||||
|
||||
// Stepper objects of TMC steppers used
|
||||
#ifdef X_IS_TMC
|
||||
TMC26XStepper stepperX(200,X_ENABLE_PIN,X_STEP_PIN,X_DIR_PIN,X_MAX_CURRENT,X_SENSE_RESISTOR);
|
||||
#endif
|
||||
#ifdef X2_IS_TMC
|
||||
TMC26XStepper stepperX2(200,X2_ENABLE_PIN,X2_STEP_PIN,X2_DIR_PIN,X2_MAX_CURRENT,X2_SENSE_RESISTOR);
|
||||
#endif
|
||||
#ifdef Y_IS_TMC
|
||||
TMC26XStepper stepperY(200,Y_ENABLE_PIN,Y_STEP_PIN,Y_DIR_PIN,Y_MAX_CURRENT,Y_SENSE_RESISTOR);
|
||||
#endif
|
||||
#ifdef Y2_IS_TMC
|
||||
TMC26XStepper stepperY2(200,Y2_ENABLE_PIN,Y2_STEP_PIN,Y2_DIR_PIN,Y2_MAX_CURRENT,Y2_SENSE_RESISTOR);
|
||||
#endif
|
||||
#ifdef Z_IS_TMC
|
||||
TMC26XStepper stepperZ(200,Z_ENABLE_PIN,Z_STEP_PIN,Z_DIR_PIN,Z_MAX_CURRENT,Z_SENSE_RESISTOR);
|
||||
#endif
|
||||
#ifdef Z2_IS_TMC
|
||||
TMC26XStepper stepperZ2(200,Z2_ENABLE_PIN,Z2_STEP_PIN,Z2_DIR_PIN,Z2_MAX_CURRENT,Z2_SENSE_RESISTOR);
|
||||
#endif
|
||||
#ifdef E0_IS_TMC
|
||||
TMC26XStepper stepperE0(200,E0_ENABLE_PIN,E0_STEP_PIN,E0_DIR_PIN,E0_MAX_CURRENT,E0_SENSE_RESISTOR);
|
||||
#endif
|
||||
#ifdef E1_IS_TMC
|
||||
TMC26XStepper stepperE1(200,E1_ENABLE_PIN,E1_STEP_PIN,E1_DIR_PIN,E1_MAX_CURRENT,E1_SENSE_RESISTOR);
|
||||
#endif
|
||||
#ifdef E2_IS_TMC
|
||||
TMC26XStepper stepperE2(200,E2_ENABLE_PIN,E2_STEP_PIN,E2_DIR_PIN,E2_MAX_CURRENT,E2_SENSE_RESISTOR);
|
||||
#endif
|
||||
#ifdef E3_IS_TMC
|
||||
TMC26XStepper stepperE3(200,E3_ENABLE_PIN,E3_STEP_PIN,E3_DIR_PIN,E3_MAX_CURRENT,E3_SENSE_RESISTOR);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TMCDRIVER
|
||||
void tmc_init()
|
||||
{
|
||||
#ifdef X_IS_TMC
|
||||
stepperX.setMicrosteps(X_MICROSTEPS);
|
||||
stepperX.start();
|
||||
#endif
|
||||
#ifdef X2_IS_TMC
|
||||
stepperX2.setMicrosteps(X2_MICROSTEPS);
|
||||
stepperX2.start();
|
||||
#endif
|
||||
#ifdef Y_IS_TMC
|
||||
stepperY.setMicrosteps(Y_MICROSTEPS);
|
||||
stepperY.start();
|
||||
#endif
|
||||
#ifdef Y2_IS_TMC
|
||||
stepperY2.setMicrosteps(Y2_MICROSTEPS);
|
||||
stepperY2.start();
|
||||
#endif
|
||||
#ifdef Z_IS_TMC
|
||||
stepperZ.setMicrosteps(Z_MICROSTEPS);
|
||||
stepperZ.start();
|
||||
#endif
|
||||
#ifdef Z2_IS_TMC
|
||||
stepperZ2.setMicrosteps(Z2_MICROSTEPS);
|
||||
stepperZ2.start();
|
||||
#endif
|
||||
#ifdef E0_IS_TMC
|
||||
stepperE0.setMicrosteps(E0_MICROSTEPS);
|
||||
stepperE0.start();
|
||||
#endif
|
||||
#ifdef E1_IS_TMC
|
||||
stepperE1.setMicrosteps(E1_MICROSTEPS);
|
||||
stepperE1.start();
|
||||
#endif
|
||||
#ifdef E2_IS_TMC
|
||||
stepperE2.setMicrosteps(E2_MICROSTEPS);
|
||||
stepperE2.start();
|
||||
#endif
|
||||
#ifdef E3_IS_TMC
|
||||
stepperE3.setMicrosteps(E3_MICROSTEPS);
|
||||
stepperE3.start();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// L6470 Driver objects and inits
|
||||
|
||||
#ifdef HAVE_L6470DRIVER
|
||||
#include <SPI.h>
|
||||
#include <L6470.h>
|
||||
#endif
|
||||
|
||||
// L6470 Stepper objects
|
||||
#ifdef X_IS_L6470
|
||||
L6470 stepperX(X_ENABLE_PIN);
|
||||
#endif
|
||||
#ifdef X2_IS_L6470
|
||||
L6470 stepperX2(X2_ENABLE_PIN);
|
||||
#endif
|
||||
#ifdef Y_IS_L6470
|
||||
L6470 stepperY(Y_ENABLE_PIN);
|
||||
#endif
|
||||
#ifdef Y2_IS_L6470
|
||||
L6470 stepperY2(Y2_ENABLE_PIN);
|
||||
#endif
|
||||
#ifdef Z_IS_L6470
|
||||
L6470 stepperZ(Z_ENABLE_PIN);
|
||||
#endif
|
||||
#ifdef Z2_IS_L6470
|
||||
L6470 stepperZ2(Z2_ENABLE_PIN);
|
||||
#endif
|
||||
#ifdef E0_IS_L6470
|
||||
L6470 stepperE0(E0_ENABLE_PIN);
|
||||
#endif
|
||||
#ifdef E1_IS_L6470
|
||||
L6470 stepperE1(E1_ENABLE_PIN);
|
||||
#endif
|
||||
#ifdef E2_IS_L6470
|
||||
L6470 stepperE2(E2_ENABLE_PIN);
|
||||
#endif
|
||||
#ifdef E3_IS_L6470
|
||||
L6470 stepperE3(E3_ENABLE_PIN);
|
||||
#endif
|
||||
|
||||
|
||||
// init routine
|
||||
#ifdef HAVE_L6470DRIVER
|
||||
void L6470_init()
|
||||
{
|
||||
#ifdef X_IS_L6470
|
||||
stepperX.init(X_K_VAL);
|
||||
stepperX.softFree();
|
||||
stepperX.setMicroSteps(X_MICROSTEPS);
|
||||
stepperX.setOverCurrent(X_OVERCURRENT); //set overcurrent protection
|
||||
stepperX.setStallCurrent(X_STALLCURRENT);
|
||||
#endif
|
||||
#ifdef X2_IS_L6470
|
||||
stepperX2.init(X2_K_VAL);
|
||||
stepperX2.softFree();
|
||||
stepperX2.setMicroSteps(X2_MICROSTEPS);
|
||||
stepperX2.setOverCurrent(X2_OVERCURRENT); //set overcurrent protection
|
||||
stepperX2.setStallCurrent(X2_STALLCURRENT);
|
||||
#endif
|
||||
#ifdef Y_IS_L6470
|
||||
stepperY.init(Y_K_VAL);
|
||||
stepperY.softFree();
|
||||
stepperY.setMicroSteps(Y_MICROSTEPS);
|
||||
stepperY.setOverCurrent(Y_OVERCURRENT); //set overcurrent protection
|
||||
stepperY.setStallCurrent(Y_STALLCURRENT);
|
||||
#endif
|
||||
#ifdef Y2_IS_L6470
|
||||
stepperY2.init(Y2_K_VAL);
|
||||
stepperY2.softFree();
|
||||
stepperY2.setMicroSteps(Y2_MICROSTEPS);
|
||||
stepperY2.setOverCurrent(Y2_OVERCURRENT); //set overcurrent protection
|
||||
stepperY2.setStallCurrent(Y2_STALLCURRENT);
|
||||
#endif
|
||||
#ifdef Z_IS_L6470
|
||||
stepperZ.init(Z_K_VAL);
|
||||
stepperZ.softFree();
|
||||
stepperZ.setMicroSteps(Z_MICROSTEPS);
|
||||
stepperZ.setOverCurrent(Z_OVERCURRENT); //set overcurrent protection
|
||||
stepperZ.setStallCurrent(Z_STALLCURRENT);
|
||||
#endif
|
||||
#ifdef Z2_IS_L6470
|
||||
stepperZ2.init(Z2_K_VAL);
|
||||
stepperZ2.softFree();
|
||||
stepperZ2.setMicroSteps(Z2_MICROSTEPS);
|
||||
stepperZ2.setOverCurrent(Z2_OVERCURRENT); //set overcurrent protection
|
||||
stepperZ2.setStallCurrent(Z2_STALLCURRENT);
|
||||
#endif
|
||||
#ifdef E0_IS_L6470
|
||||
stepperE0.init(E0_K_VAL);
|
||||
stepperE0.softFree();
|
||||
stepperE0.setMicroSteps(E0_MICROSTEPS);
|
||||
stepperE0.setOverCurrent(E0_OVERCURRENT); //set overcurrent protection
|
||||
stepperE0.setStallCurrent(E0_STALLCURRENT);
|
||||
#endif
|
||||
#ifdef E1_IS_L6470
|
||||
stepperE1.init(E1_K_VAL);
|
||||
stepperE1.softFree();
|
||||
stepperE1.setMicroSteps(E1_MICROSTEPS);
|
||||
stepperE1.setOverCurrent(E1_OVERCURRENT); //set overcurrent protection
|
||||
stepperE1.setStallCurrent(E1_STALLCURRENT);
|
||||
#endif
|
||||
#ifdef E2_IS_L6470
|
||||
stepperE2.init(E2_K_VAL);
|
||||
stepperE2.softFree();
|
||||
stepperE2.setMicroSteps(E2_MICROSTEPS);
|
||||
stepperE2.setOverCurrent(E2_OVERCURRENT); //set overcurrent protection
|
||||
stepperE2.setStallCurrent(E2_STALLCURRENT);
|
||||
#endif
|
||||
#ifdef E3_IS_L6470
|
||||
stepperE3.init(E3_K_VAL);
|
||||
stepperE3.softFree();
|
||||
stepperE3.setMicroSteps(E3_MICROSTEPS);
|
||||
stepperE3.setOverCurrent(E3_OVERCURRENT); //set overcurrent protection
|
||||
stepperE3.setStallCurrent(E3_STALLCURRENT);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
492
Marlin/stepper_indirection.h
Normal file
492
Marlin/stepper_indirection.h
Normal file
@ -0,0 +1,492 @@
|
||||
/*
|
||||
stepper_indirection.h - stepper motor driver indirection macros
|
||||
to allow some stepper functions to be done via SPI/I2c instead of direct pin manipulation
|
||||
Part of Marlin
|
||||
|
||||
Copyright (c) 2015 Dominik Wenger
|
||||
|
||||
Marlin is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Marlin is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Marlin. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef STEPPER_INDIRECTION_H
|
||||
#define STEPPER_INDIRECTION_H
|
||||
|
||||
// X motor
|
||||
#define X_STEP_INIT SET_OUTPUT(X_STEP_PIN)
|
||||
#define X_STEP_WRITE(STATE) WRITE(X_STEP_PIN,STATE)
|
||||
#define X_STEP_READ READ(X_STEP_PIN)
|
||||
|
||||
#define X_DIR_INIT SET_OUTPUT(X_DIR_PIN)
|
||||
#define X_DIR_WRITE(STATE) WRITE(X_DIR_PIN,STATE)
|
||||
#define X_DIR_READ READ(X_DIR_PIN)
|
||||
|
||||
#define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
|
||||
#define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE)
|
||||
#define X_ENABLE_READ READ(X_ENABLE_PIN)
|
||||
|
||||
// X2 motor
|
||||
#define X2_STEP_INIT SET_OUTPUT(X2_STEP_PIN)
|
||||
#define X2_STEP_WRITE(STATE) WRITE(X2_STEP_PIN,STATE)
|
||||
#define X2_STEP_READ READ(X2_STEP_PIN)
|
||||
|
||||
#define X2_DIR_INIT SET_OUTPUT(X2_DIR_PIN)
|
||||
#define X2_DIR_WRITE(STATE) WRITE(X2_DIR_PIN,STATE)
|
||||
#define X2_DIR_READ READ(X_DIR_PIN)
|
||||
|
||||
#define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
|
||||
#define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
|
||||
#define X2_ENABLE_READ READ(X_ENABLE_PIN)
|
||||
|
||||
// Y motor
|
||||
#define Y_STEP_INIT SET_OUTPUT(Y_STEP_PIN)
|
||||
#define Y_STEP_WRITE(STATE) WRITE(Y_STEP_PIN,STATE)
|
||||
#define Y_STEP_READ READ(Y_STEP_PIN)
|
||||
|
||||
#define Y_DIR_INIT SET_OUTPUT(Y_DIR_PIN)
|
||||
#define Y_DIR_WRITE(STATE) WRITE(Y_DIR_PIN,STATE)
|
||||
#define Y_DIR_READ READ(Y_DIR_PIN)
|
||||
|
||||
#define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
|
||||
#define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
|
||||
#define Y_ENABLE_READ READ(Y_ENABLE_PIN)
|
||||
|
||||
// Y2 motor
|
||||
#define Y2_STEP_INIT SET_OUTPUT(Y2_STEP_PIN)
|
||||
#define Y2_STEP_WRITE(STATE) WRITE(Y2_STEP_PIN,STATE)
|
||||
#define Y2_STEP_READ READ(Y2_STEP_PIN)
|
||||
|
||||
#define Y2_DIR_INIT SET_OUTPUT(Y2_DIR_PIN)
|
||||
#define Y2_DIR_WRITE(STATE) WRITE(Y2_DIR_PIN,STATE)
|
||||
#define Y2_DIR_READ READ(Y2_DIR_PIN)
|
||||
|
||||
#define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
|
||||
#define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
|
||||
#define Y2_ENABLE_READ READ(Y2_ENABLE_PIN)
|
||||
|
||||
// Z motor
|
||||
#define Z_STEP_INIT SET_OUTPUT(Z_STEP_PIN)
|
||||
#define Z_STEP_WRITE(STATE) WRITE(Z_STEP_PIN,STATE)
|
||||
#define Z_STEP_READ READ(Z_STEP_PIN)
|
||||
|
||||
#define Z_DIR_INIT SET_OUTPUT(Z_DIR_PIN)
|
||||
#define Z_DIR_WRITE(STATE) WRITE(Z_DIR_PIN,STATE)
|
||||
#define Z_DIR_READ READ(Z_DIR_PIN)
|
||||
|
||||
#define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
|
||||
#define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
|
||||
#define Z_ENABLE_READ READ(Z_ENABLE_PIN)
|
||||
|
||||
// Z2 motor
|
||||
#define Z2_STEP_INIT SET_OUTPUT(Z2_STEP_PIN)
|
||||
#define Z2_STEP_WRITE(STATE) WRITE(Z2_STEP_PIN,STATE)
|
||||
#define Z2_STEP_READ READ(Z2_STEP_PIN)
|
||||
|
||||
#define Z2_DIR_INIT SET_OUTPUT(Z2_DIR_PIN)
|
||||
#define Z2_DIR_WRITE(STATE) WRITE(Z2_DIR_PIN,STATE)
|
||||
#define Z2_DIR_READ READ(Z2_DIR_PIN)
|
||||
|
||||
#define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
|
||||
#define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
|
||||
#define Z2_ENABLE_READ READ(Z2_ENABLE_PIN)
|
||||
|
||||
// E0 motor
|
||||
#define E0_STEP_INIT SET_OUTPUT(E0_STEP_PIN)
|
||||
#define E0_STEP_WRITE(STATE) WRITE(E0_STEP_PIN,STATE)
|
||||
#define E0_STEP_READ READ(E0_STEP_PIN)
|
||||
|
||||
#define E0_DIR_INIT SET_OUTPUT(E0_DIR_PIN)
|
||||
#define E0_DIR_WRITE(STATE) WRITE(E0_DIR_PIN,STATE)
|
||||
#define E0_DIR_READ READ(E0_DIR_PIN)
|
||||
|
||||
#define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
|
||||
#define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE)
|
||||
#define E0_ENABLE_READ READ(E0_ENABLE_PIN)
|
||||
|
||||
// E1 motor
|
||||
#define E1_STEP_INIT SET_OUTPUT(E1_STEP_PIN)
|
||||
#define E1_STEP_WRITE(STATE) WRITE(E1_STEP_PIN,STATE)
|
||||
#define E1_STEP_READ READ(E1_STEP_PIN)
|
||||
|
||||
#define E1_DIR_INIT SET_OUTPUT(E1_DIR_PIN)
|
||||
#define E1_DIR_WRITE(STATE) WRITE(E1_DIR_PIN,STATE)
|
||||
#define E1_DIR_READ READ(E1_DIR_PIN)
|
||||
|
||||
#define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
|
||||
#define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE)
|
||||
#define E1_ENABLE_READ READ(E1_ENABLE_PIN)
|
||||
|
||||
// E2 motor
|
||||
#define E2_STEP_INIT SET_OUTPUT(E2_STEP_PIN)
|
||||
#define E2_STEP_WRITE(STATE) WRITE(E2_STEP_PIN,STATE)
|
||||
#define E2_STEP_READ READ(E2_STEP_PIN)
|
||||
|
||||
#define E2_DIR_INIT SET_OUTPUT(E2_DIR_PIN)
|
||||
#define E2_DIR_WRITE(STATE) WRITE(E2_DIR_PIN,STATE)
|
||||
#define E2_DIR_READ READ(E2_DIR_PIN)
|
||||
|
||||
#define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
|
||||
#define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE)
|
||||
#define E2_ENABLE_READ READ(E2_ENABLE_PIN)
|
||||
|
||||
// E3 motor
|
||||
#define E3_STEP_INIT SET_OUTPUT(E3_STEP_PIN)
|
||||
#define E3_STEP_WRITE(STATE) WRITE(E3_STEP_PIN,STATE)
|
||||
#define E3_STEP_READ READ(E3_STEP_PIN)
|
||||
|
||||
#define E3_DIR_INIT SET_OUTPUT(E3_DIR_PIN)
|
||||
#define E3_DIR_WRITE(STATE) WRITE(E3_DIR_PIN,STATE)
|
||||
#define E3_DIR_READ READ(E3_DIR_PIN)
|
||||
|
||||
#define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
|
||||
#define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE)
|
||||
#define E3_ENABLE_READ READ(E3_ENABLE_PIN)
|
||||
|
||||
//////////////////////////////////
|
||||
// Pin redefines for TMC drivers.
|
||||
// TMC26X drivers have step and dir on normal pins, but everything else via SPI
|
||||
//////////////////////////////////
|
||||
#ifdef HAVE_TMCDRIVER
|
||||
#include <SPI.h>
|
||||
#include <TMC26XStepper.h>
|
||||
|
||||
void tmc_init();
|
||||
#ifdef X_IS_TMC
|
||||
extern TMC26XStepper stepperX;
|
||||
#undef X_ENABLE_INIT
|
||||
#define X_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef X_ENABLE_WRITE
|
||||
#define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
|
||||
|
||||
#undef X_ENABLE_READ
|
||||
#define X_ENABLE_READ stepperX.isEnabled()
|
||||
|
||||
#endif
|
||||
#ifdef X2_IS_TMC
|
||||
extern TMC26XStepper stepperX2;
|
||||
#undef X2_ENABLE_INIT
|
||||
#define X2_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef X2_ENABLE_WRITE
|
||||
#define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
|
||||
|
||||
#undef X2_ENABLE_READ
|
||||
#define X2_ENABLE_READ stepperX2.isEnabled()
|
||||
#endif
|
||||
#ifdef Y_IS_TMC
|
||||
extern TMC26XStepper stepperY;
|
||||
#undef Y_ENABLE_INIT
|
||||
#define Y_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef Y_ENABLE_WRITE
|
||||
#define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
|
||||
|
||||
#undef Y_ENABLE_READ
|
||||
#define Y_ENABLE_READ stepperY.isEnabled()
|
||||
#endif
|
||||
#ifdef Y2_IS_TMC
|
||||
extern TMC26XStepper stepperY2;
|
||||
#undef Y2_ENABLE_INIT
|
||||
#define Y2_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef Y2_ENABLE_WRITE
|
||||
#define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
|
||||
|
||||
#undef Y2_ENABLE_READ
|
||||
#define Y2_ENABLE_READ stepperY2.isEnabled()
|
||||
#endif
|
||||
#ifdef Z_IS_TMC
|
||||
extern TMC26XStepper stepperZ;
|
||||
#undef Z_ENABLE_INIT
|
||||
#define Z_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef Z_ENABLE_WRITE
|
||||
#define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
|
||||
|
||||
#undef Z_ENABLE_READ
|
||||
#define Z_ENABLE_READ stepperZ.isEnabled()
|
||||
#endif
|
||||
#ifdef Z2_IS_TMC
|
||||
extern TMC26XStepper stepperZ2;
|
||||
#undef Z2_ENABLE_INIT
|
||||
#define Z2_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef Z2_ENABLE_WRITE
|
||||
#define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
|
||||
|
||||
#undef Z2_ENABLE_READ
|
||||
#define Z2_ENABLE_READ stepperZ2.isEnabled()
|
||||
#endif
|
||||
#ifdef E0_IS_TMC
|
||||
extern TMC26XStepper stepperE0;
|
||||
#undef E0_ENABLE_INIT
|
||||
#define E0_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef E0_ENABLE_WRITE
|
||||
#define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
|
||||
|
||||
#undef E0_ENABLE_READ
|
||||
#define E0_ENABLE_READ stepperE0.isEnabled()
|
||||
#endif
|
||||
#ifdef E1_IS_TMC
|
||||
extern TMC26XStepper stepperE1;
|
||||
#undef E1_ENABLE_INIT
|
||||
#define E1_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef E1_ENABLE_WRITE
|
||||
#define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
|
||||
|
||||
#undef E1_ENABLE_READ
|
||||
#define E1_ENABLE_READ stepperE1.isEnabled()
|
||||
#endif
|
||||
#ifdef E2_IS_TMC
|
||||
extern TMC26XStepper stepperE2;
|
||||
#undef E2_ENABLE_INIT
|
||||
#define E2_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef E2_ENABLE_WRITE
|
||||
#define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
|
||||
|
||||
#undef E2_ENABLE_READ
|
||||
#define E2_ENABLE_READ stepperE2.isEnabled()
|
||||
#endif
|
||||
#ifdef E3_IS_TMC
|
||||
extern TMC26XStepper stepperE3;
|
||||
#undef E3_ENABLE_INIT
|
||||
#define E3_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef E3_ENABLE_WRITE
|
||||
#define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
|
||||
|
||||
#undef E3_ENABLE_READ
|
||||
#define E3_ENABLE_READ stepperE3.isEnabled()
|
||||
#endif
|
||||
|
||||
#endif // HAVE_TMCDRIVER
|
||||
|
||||
//////////////////////////////////
|
||||
// Pin redefines for L6470 drivers.
|
||||
// L640 drivers have step on normal pins, but dir and everything else via SPI
|
||||
//////////////////////////////////
|
||||
#ifdef HAVE_L6470DRIVER
|
||||
|
||||
#include <SPI.h>
|
||||
#include <L6470.h>
|
||||
|
||||
void L6470_init();
|
||||
#ifdef X_IS_L6470
|
||||
extern L6470 stepperX;
|
||||
#undef X_ENABLE_INIT
|
||||
#define X_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef X_ENABLE_WRITE
|
||||
#define X_ENABLE_WRITE(STATE) {if(STATE) stepperX.Step_Clock(stepperX.getStatus() & STATUS_HIZ); else stepperX.softFree();}
|
||||
|
||||
#undef X_ENABLE_READ
|
||||
#define X_ENABLE_READ (stepperX.getStatus() & STATUS_HIZ)
|
||||
|
||||
#undef X_DIR_INIT
|
||||
#define X_DIR_INIT ((void)0)
|
||||
|
||||
#undef X_DIR_WRITE
|
||||
#define X_DIR_WRITE(STATE) stepperX.Step_Clock(STATE)
|
||||
|
||||
#undef X_DIR_READ
|
||||
#define X_DIR_READ (stepperX.getStatus() & STATUS_DIR)
|
||||
|
||||
#endif
|
||||
#ifdef X2_IS_L6470
|
||||
extern L6470 stepperX2;
|
||||
#undef X2_ENABLE_INIT
|
||||
#define X2_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef X2_ENABLE_WRITE
|
||||
#define X2_ENABLE_WRITE(STATE) (if(STATE) stepperX2.Step_Clock(stepperX2.getStatus() & STATUS_HIZ); else stepperX2.softFree();)
|
||||
|
||||
#undef X2_ENABLE_READ
|
||||
#define X2_ENABLE_READ (stepperX2.getStatus() & STATUS_HIZ)
|
||||
|
||||
#undef X2_DIR_INIT
|
||||
#define X2_DIR_INIT ((void)0)
|
||||
|
||||
#undef X2_DIR_WRITE
|
||||
#define X2_DIR_WRITE(STATE) stepperX2.Step_Clock(STATE)
|
||||
|
||||
#undef X2_DIR_READ
|
||||
#define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR)
|
||||
#endif
|
||||
#ifdef Y_IS_L6470
|
||||
extern L6470 stepperY;
|
||||
#undef Y_ENABLE_INIT
|
||||
#define Y_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef Y_ENABLE_WRITE
|
||||
#define Y_ENABLE_WRITE(STATE) (if(STATE) stepperY.Step_Clock(stepperY.getStatus() & STATUS_HIZ); else stepperY.softFree();)
|
||||
|
||||
#undef Y_ENABLE_READ
|
||||
#define Y_ENABLE_READ (stepperY.getStatus() & STATUS_HIZ)
|
||||
|
||||
#undef Y_DIR_INIT
|
||||
#define Y_DIR_INIT ((void)0)
|
||||
|
||||
#undef Y_DIR_WRITE
|
||||
#define Y_DIR_WRITE(STATE) stepperY.Step_Clock(STATE)
|
||||
|
||||
#undef Y_DIR_READ
|
||||
#define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR)
|
||||
#endif
|
||||
#ifdef Y2_IS_L6470
|
||||
extern L6470 stepperY2;
|
||||
#undef Y2_ENABLE_INIT
|
||||
#define Y2_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef Y2_ENABLE_WRITE
|
||||
#define Y2_ENABLE_WRITE(STATE) (if(STATE) stepperY2.Step_Clock(stepperY2.getStatus() & STATUS_HIZ); else stepperY2.softFree();)
|
||||
|
||||
#undef Y2_ENABLE_READ
|
||||
#define Y2_ENABLE_READ (stepperY2.getStatus() & STATUS_HIZ)
|
||||
|
||||
#undef Y2_DIR_INIT
|
||||
#define Y2_DIR_INIT ((void)0)
|
||||
|
||||
#undef Y2_DIR_WRITE
|
||||
#define Y2_DIR_WRITE(STATE) stepperY2.Step_Clock(STATE)
|
||||
|
||||
#undef Y2_DIR_READ
|
||||
#define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR)
|
||||
#endif
|
||||
#ifdef Z_IS_L6470
|
||||
extern L6470 stepperZ;
|
||||
#undef Z_ENABLE_INIT
|
||||
#define Z_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef Z_ENABLE_WRITE
|
||||
#define Z_ENABLE_WRITE(STATE) (if(STATE) stepperZ.Step_Clock(stepperZ.getStatus() & STATUS_HIZ); else stepperZ.softFree();)
|
||||
|
||||
#undef Z_ENABLE_READ
|
||||
#define Z_ENABLE_READ (stepperZ.getStatus() & STATUS_HIZ)
|
||||
|
||||
#undef Z_DIR_INIT
|
||||
#define Z_DIR_INIT ((void)0)
|
||||
|
||||
#undef Z_DIR_WRITE
|
||||
#define Z_DIR_WRITE(STATE) stepperZ.Step_Clock(STATE)
|
||||
|
||||
#undef Y_DIR_READ
|
||||
#define Y_DIR_READ (stepperZ.getStatus() & STATUS_DIR)
|
||||
#endif
|
||||
#ifdef Z2_IS_L6470
|
||||
extern L6470 stepperZ2;
|
||||
#undef Z2_ENABLE_INIT
|
||||
#define Z2_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef Z2_ENABLE_WRITE
|
||||
#define Z2_ENABLE_WRITE(STATE) (if(STATE) stepperZ2.Step_Clock(stepperZ2.getStatus() & STATUS_HIZ); else stepperZ2.softFree();)
|
||||
|
||||
#undef Z2_ENABLE_READ
|
||||
#define Z2_ENABLE_READ (stepperZ2.getStatus() & STATUS_HIZ)
|
||||
|
||||
#undef Z2_DIR_INIT
|
||||
#define Z2_DIR_INIT ((void)0)
|
||||
|
||||
#undef Z2_DIR_WRITE
|
||||
#define Z2_DIR_WRITE(STATE) stepperZ2.Step_Clock(STATE)
|
||||
|
||||
#undef Y2_DIR_READ
|
||||
#define Y2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR)
|
||||
#endif
|
||||
#ifdef E0_IS_L6470
|
||||
extern L6470 stepperE0;
|
||||
#undef E0_ENABLE_INIT
|
||||
#define E0_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef E0_ENABLE_WRITE
|
||||
#define E0_ENABLE_WRITE(STATE) (if(STATE) stepperE0.Step_Clock(stepperE0.getStatus() & STATUS_HIZ); else stepperE0.softFree();)
|
||||
|
||||
#undef E0_ENABLE_READ
|
||||
#define E0_ENABLE_READ (stepperE0.getStatus() & STATUS_HIZ)
|
||||
|
||||
#undef E0_DIR_INIT
|
||||
#define E0_DIR_INIT ((void)0)
|
||||
|
||||
#undef E0_DIR_WRITE
|
||||
#define E0_DIR_WRITE(STATE) stepperE0.Step_Clock(STATE)
|
||||
|
||||
#undef E0_DIR_READ
|
||||
#define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR)
|
||||
#endif
|
||||
#ifdef E1_IS_L6470
|
||||
extern L6470 stepperE1;
|
||||
#undef E1_ENABLE_INIT
|
||||
#define E1_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef E1_ENABLE_WRITE
|
||||
#define E1_ENABLE_WRITE(STATE) (if(STATE) stepperE1.Step_Clock(stepperE1.getStatus() & STATUS_HIZ); else stepperE1.softFree();)
|
||||
|
||||
#undef E1_ENABLE_READ
|
||||
#define E1_ENABLE_READ (stepperE1.getStatus() & STATUS_HIZ)
|
||||
|
||||
#undef E1_DIR_INIT
|
||||
#define E1_DIR_INIT ((void)0)
|
||||
|
||||
#undef E1_DIR_WRITE
|
||||
#define E1_DIR_WRITE(STATE) stepperE1.Step_Clock(STATE)
|
||||
|
||||
#undef E1_DIR_READ
|
||||
#define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR)
|
||||
#endif
|
||||
#ifdef E2_IS_L6470
|
||||
extern L6470 stepperE2;
|
||||
#undef E2_ENABLE_INIT
|
||||
#define E2_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef E2_ENABLE_WRITE
|
||||
#define E2_ENABLE_WRITE(STATE) (if(STATE) stepperE2.Step_Clock(stepperE2.getStatus() & STATUS_HIZ); else stepperE2.softFree();)
|
||||
|
||||
#undef E2_ENABLE_READ
|
||||
#define E2_ENABLE_READ (stepperE2.getStatus() & STATUS_HIZ)
|
||||
|
||||
#undef E2_DIR_INIT
|
||||
#define E2_DIR_INIT ((void)0)
|
||||
|
||||
#undef E2_DIR_WRITE
|
||||
#define E2_DIR_WRITE(STATE) stepperE2.Step_Clock(STATE)
|
||||
|
||||
#undef E2_DIR_READ
|
||||
#define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR)
|
||||
#endif
|
||||
#ifdef E3_IS_L6470
|
||||
extern L6470 stepperE3;
|
||||
#undef E3_ENABLE_INIT
|
||||
#define E3_ENABLE_INIT ((void)0)
|
||||
|
||||
#undef E3_ENABLE_WRITE
|
||||
#define E3_ENABLE_WRITE(STATE) (if(STATE) stepperE3.Step_Clock(stepperE3.getStatus() & STATUS_HIZ); else stepperE3.softFree();)
|
||||
|
||||
#undef E3_ENABLE_READ
|
||||
#define E3_ENABLE_READ (stepperE3.getStatus() & STATUS_HIZ)
|
||||
|
||||
#undef E3_DIR_INIT
|
||||
#define E3_DIR_INIT ((void)0)
|
||||
|
||||
#undef E3_DIR_WRITE
|
||||
#define E3_DIR_WRITE(STATE) stepperE3.Step_Clock(STATE)
|
||||
|
||||
#undef E3_DIR_READ
|
||||
#define E3_DIR_READ (stepperE3.getStatus() & STATUS_DIR)
|
||||
#endif
|
||||
|
||||
#endif //HAVE_L6470DRIVER
|
||||
|
||||
#endif // STEPPER_INDIRECTION_H
|
Reference in New Issue
Block a user