Elide delayMicroseconds for TMC2130 in non-DEDGE mode
Introduce new macros TMC2130_MINIMUM_DELAY/STEPPER_MINIMUM_DELAY for blocking pauses. If MINIMUM_PULSE has defined to be zero, avoid the delay call entirely.
This commit is contained in:
parent
78bbfc6237
commit
4fed728e08
3 changed files with 15 additions and 7 deletions
|
@ -75,9 +75,11 @@ uint16_t SP_min = 0x21FF;
|
|||
#ifdef TMC2130
|
||||
#define STEPPER_MINIMUM_PULSE TMC2130_MINIMUM_PULSE
|
||||
#define STEPPER_SET_DIR_DELAY TMC2130_SET_DIR_DELAY
|
||||
#define STEPPER_MINIMUM_DELAY TMC2130_MINIMUM_DELAY
|
||||
#else
|
||||
#define STEPPER_MINIMUM_PULSE 2
|
||||
#define STEPPER_SET_DIR_DELAY 100
|
||||
#define STEPPER_MINIMUM_DELAY delayMicroseconds(STEPPER_MINIMUM_PULSE)
|
||||
#endif
|
||||
|
||||
#ifdef TMC2130_DEDGE_STEPPING
|
||||
|
@ -1448,7 +1450,7 @@ void babystep(const uint8_t axis,const bool direction)
|
|||
STEP_NC_HI(X_DUP_AXIS);
|
||||
#endif
|
||||
#ifndef TMC2130_DEDGE_STEPPING
|
||||
delayMicroseconds(STEPPER_MINIMUM_PULSE);
|
||||
STEPPER_MINIMUM_DELAY;
|
||||
STEP_NC_LO(X_AXIS);
|
||||
#ifdef DEBUG_XSTEP_DUP_PIN
|
||||
STEP_NC_LO(X_DUP_AXIS);
|
||||
|
@ -1478,7 +1480,7 @@ void babystep(const uint8_t axis,const bool direction)
|
|||
STEP_NC_HI(Y_DUP_AXIS);
|
||||
#endif
|
||||
#ifndef TMC2130_DEDGE_STEPPING
|
||||
delayMicroseconds(STEPPER_MINIMUM_PULSE);
|
||||
STEPPER_MINIMUM_DELAY;
|
||||
STEP_NC_LO(Y_AXIS);
|
||||
#ifdef DEBUG_YSTEP_DUP_PIN
|
||||
STEP_NC_LO(Y_DUP_AXIS);
|
||||
|
@ -1511,7 +1513,7 @@ void babystep(const uint8_t axis,const bool direction)
|
|||
STEP_NC_HI(Z2_AXIS);
|
||||
#endif
|
||||
#ifndef TMC2130_DEDGE_STEPPING
|
||||
delayMicroseconds(STEPPER_MINIMUM_PULSE);
|
||||
STEPPER_MINIMUM_DELAY;
|
||||
STEP_NC_LO(Z_AXIS);
|
||||
#ifdef Z_DUAL_STEPPER_DRIVERS
|
||||
STEP_NC_LO(Z2_AXIS);
|
||||
|
|
|
@ -717,10 +717,10 @@ static uint8_t tmc2130_rx(uint8_t axis, uint8_t addr, uint32_t* rval)
|
|||
#define _DO_STEP_Z TOGGLE(Z_STEP_PIN)
|
||||
#define _DO_STEP_E TOGGLE(E0_STEP_PIN)
|
||||
#else
|
||||
#define _DO_STEP_X { WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); delayMicroseconds(TMC2130_MINIMUM_PULSE); WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); }
|
||||
#define _DO_STEP_Y { WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN); delayMicroseconds(TMC2130_MINIMUM_PULSE); WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); }
|
||||
#define _DO_STEP_Z { WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN); delayMicroseconds(TMC2130_MINIMUM_PULSE); WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN); }
|
||||
#define _DO_STEP_E { WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN); delayMicroseconds(TMC2130_MINIMUM_PULSE); WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN); }
|
||||
#define _DO_STEP_X { WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); TMC2130_MINIMUM_DELAY; WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); }
|
||||
#define _DO_STEP_Y { WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN); TMC2130_MINIMUM_DELAY; WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); }
|
||||
#define _DO_STEP_Z { WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN); TMC2130_MINIMUM_DELAY; WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN); }
|
||||
#define _DO_STEP_E { WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN); TMC2130_MINIMUM_DELAY; WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN); }
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,12 @@ extern uint8_t tmc2130_sg_homing_axes_mask;
|
|||
#define TMC2130_SET_DIR_DELAY 20 // minimum delay after setting direction in uS
|
||||
#define TMC2130_SET_PWR_DELAY 0 // minimum delay after changing pwr mode in uS
|
||||
|
||||
#if TMC2130_MINIMUM_PULSE == 0
|
||||
#define TMC2130_MINIMUM_DELAY //NOP
|
||||
#else
|
||||
#define TMC2130_MINIMUM_DELAY delayMicroseconds(TMC2130_MINIMUM_PULSE)
|
||||
#endif
|
||||
|
||||
extern uint8_t tmc2130_home_enabled;
|
||||
extern uint8_t tmc2130_home_origin[2];
|
||||
extern uint8_t tmc2130_home_bsteps[2];
|
||||
|
|
Loading…
Add table
Reference in a new issue