Add AXIS_HAS_SQUARE_WAVE shorthand

This commit is contained in:
Scott Lahteine 2019-06-12 21:09:41 -05:00
parent bf8bfb5c66
commit fc73a8b004

View file

@ -95,6 +95,8 @@
void restore_stepper_drivers(); // Called by PSU_ON void restore_stepper_drivers(); // Called by PSU_ON
void reset_stepper_drivers(); // Called by settings.load / settings.reset void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define AXIS_HAS_SQUARE_WAVE(A) (AXIS_IS_TMC(A) && ENABLED(SQUARE_WAVE_STEPPING))
// X Stepper // X Stepper
#if AXIS_DRIVER_TYPE_X(L6470) #if AXIS_DRIVER_TYPE_X(L6470)
extern L6470 stepperX; extern L6470 stepperX;
@ -127,7 +129,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define X_DIR_READ READ(X_DIR_PIN) #define X_DIR_READ READ(X_DIR_PIN)
#endif #endif
#define X_STEP_INIT SET_OUTPUT(X_STEP_PIN) #define X_STEP_INIT SET_OUTPUT(X_STEP_PIN)
#if AXIS_IS_TMC(X) && ENABLED(SQUARE_WAVE_STEPPING) #if AXIS_HAS_SQUARE_WAVE(X)
#define X_STEP_WRITE(STATE) do { if(STATE) TOGGLE(X_STEP_PIN); } while(0) #define X_STEP_WRITE(STATE) do { if(STATE) TOGGLE(X_STEP_PIN); } while(0)
#else #else
#define X_STEP_WRITE(STATE) WRITE(X_STEP_PIN,STATE) #define X_STEP_WRITE(STATE) WRITE(X_STEP_PIN,STATE)
@ -166,7 +168,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Y_DIR_READ READ(Y_DIR_PIN) #define Y_DIR_READ READ(Y_DIR_PIN)
#endif #endif
#define Y_STEP_INIT SET_OUTPUT(Y_STEP_PIN) #define Y_STEP_INIT SET_OUTPUT(Y_STEP_PIN)
#if AXIS_IS_TMC(Y) && ENABLED(SQUARE_WAVE_STEPPING) #if AXIS_HAS_SQUARE_WAVE(Y)
#define Y_STEP_WRITE(STATE) do { if (STATE) TOGGLE(Y_STEP_PIN); } while(0) #define Y_STEP_WRITE(STATE) do { if (STATE) TOGGLE(Y_STEP_PIN); } while(0)
#else #else
#define Y_STEP_WRITE(STATE) WRITE(Y_STEP_PIN,STATE) #define Y_STEP_WRITE(STATE) WRITE(Y_STEP_PIN,STATE)
@ -205,7 +207,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Z_DIR_READ READ(Z_DIR_PIN) #define Z_DIR_READ READ(Z_DIR_PIN)
#endif #endif
#define Z_STEP_INIT SET_OUTPUT(Z_STEP_PIN) #define Z_STEP_INIT SET_OUTPUT(Z_STEP_PIN)
#if AXIS_IS_TMC(Z) && ENABLED(SQUARE_WAVE_STEPPING) #if AXIS_HAS_SQUARE_WAVE(Z)
#define Z_STEP_WRITE(STATE) do { if(STATE) TOGGLE(Z_STEP_PIN); } while(0) #define Z_STEP_WRITE(STATE) do { if(STATE) TOGGLE(Z_STEP_PIN); } while(0)
#else #else
#define Z_STEP_WRITE(STATE) WRITE(Z_STEP_PIN,STATE) #define Z_STEP_WRITE(STATE) WRITE(Z_STEP_PIN,STATE)
@ -245,7 +247,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define X2_DIR_READ READ(X2_DIR_PIN) #define X2_DIR_READ READ(X2_DIR_PIN)
#endif #endif
#define X2_STEP_INIT SET_OUTPUT(X2_STEP_PIN) #define X2_STEP_INIT SET_OUTPUT(X2_STEP_PIN)
#if AXIS_IS_TMC(X2) && ENABLED(SQUARE_WAVE_STEPPING) #if AXIS_HAS_SQUARE_WAVE(X2)
#define X2_STEP_WRITE(STATE) do { if(STATE) TOGGLE(X2_STEP_PIN); } while(0) #define X2_STEP_WRITE(STATE) do { if(STATE) TOGGLE(X2_STEP_PIN); } while(0)
#else #else
#define X2_STEP_WRITE(STATE) WRITE(X2_STEP_PIN,STATE) #define X2_STEP_WRITE(STATE) WRITE(X2_STEP_PIN,STATE)
@ -287,7 +289,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Y2_DIR_READ READ(Y2_DIR_PIN) #define Y2_DIR_READ READ(Y2_DIR_PIN)
#endif #endif
#define Y2_STEP_INIT SET_OUTPUT(Y2_STEP_PIN) #define Y2_STEP_INIT SET_OUTPUT(Y2_STEP_PIN)
#if AXIS_IS_TMC(Y2) && ENABLED(SQUARE_WAVE_STEPPING) #if AXIS_HAS_SQUARE_WAVE(Y2)
#define Y2_STEP_WRITE(STATE) do { if(STATE) TOGGLE(Y2_STEP_PIN); } while(0) #define Y2_STEP_WRITE(STATE) do { if(STATE) TOGGLE(Y2_STEP_PIN); } while(0)
#else #else
#define Y2_STEP_WRITE(STATE) WRITE(Y2_STEP_PIN,STATE) #define Y2_STEP_WRITE(STATE) WRITE(Y2_STEP_PIN,STATE)
@ -331,7 +333,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Z2_DIR_READ READ(Z2_DIR_PIN) #define Z2_DIR_READ READ(Z2_DIR_PIN)
#endif #endif
#define Z2_STEP_INIT SET_OUTPUT(Z2_STEP_PIN) #define Z2_STEP_INIT SET_OUTPUT(Z2_STEP_PIN)
#if AXIS_IS_TMC(Z2) && ENABLED(SQUARE_WAVE_STEPPING) #if AXIS_HAS_SQUARE_WAVE(Z2)
#define Z2_STEP_WRITE(STATE) do { if(STATE) TOGGLE(Z2_STEP_PIN); } while(0) #define Z2_STEP_WRITE(STATE) do { if(STATE) TOGGLE(Z2_STEP_PIN); } while(0)
#else #else
#define Z2_STEP_WRITE(STATE) WRITE(Z2_STEP_PIN,STATE) #define Z2_STEP_WRITE(STATE) WRITE(Z2_STEP_PIN,STATE)
@ -375,7 +377,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Z3_DIR_READ READ(Z3_DIR_PIN) #define Z3_DIR_READ READ(Z3_DIR_PIN)
#endif #endif
#define Z3_STEP_INIT SET_OUTPUT(Z3_STEP_PIN) #define Z3_STEP_INIT SET_OUTPUT(Z3_STEP_PIN)
#if AXIS_IS_TMC(Z3) && ENABLED(SQUARE_WAVE_STEPPING) #if AXIS_HAS_SQUARE_WAVE(Z3)
#define Z3_STEP_WRITE(STATE) do { if(STATE) TOGGLE(Z3_STEP_PIN); } while(0) #define Z3_STEP_WRITE(STATE) do { if(STATE) TOGGLE(Z3_STEP_PIN); } while(0)
#else #else
#define Z3_STEP_WRITE(STATE) WRITE(Z3_STEP_PIN,STATE) #define Z3_STEP_WRITE(STATE) WRITE(Z3_STEP_PIN,STATE)
@ -418,7 +420,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E0_DIR_READ READ(E0_DIR_PIN) #define E0_DIR_READ READ(E0_DIR_PIN)
#endif #endif
#define E0_STEP_INIT SET_OUTPUT(E0_STEP_PIN) #define E0_STEP_INIT SET_OUTPUT(E0_STEP_PIN)
#if AXIS_IS_TMC(E0) && ENABLED(SQUARE_WAVE_STEPPING) #if AXIS_HAS_SQUARE_WAVE(E0)
#define E0_STEP_WRITE(STATE) do { if(STATE) TOGGLE(E0_STEP_PIN); } while(0) #define E0_STEP_WRITE(STATE) do { if(STATE) TOGGLE(E0_STEP_PIN); } while(0)
#else #else
#define E0_STEP_WRITE(STATE) WRITE(E0_STEP_PIN,STATE) #define E0_STEP_WRITE(STATE) WRITE(E0_STEP_PIN,STATE)
@ -457,7 +459,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E1_DIR_READ READ(E1_DIR_PIN) #define E1_DIR_READ READ(E1_DIR_PIN)
#endif #endif
#define E1_STEP_INIT SET_OUTPUT(E1_STEP_PIN) #define E1_STEP_INIT SET_OUTPUT(E1_STEP_PIN)
#if AXIS_IS_TMC(E1) && ENABLED(SQUARE_WAVE_STEPPING) #if AXIS_HAS_SQUARE_WAVE(E1)
#define E1_STEP_WRITE(STATE) do { if(STATE) TOGGLE(E1_STEP_PIN); } while(0) #define E1_STEP_WRITE(STATE) do { if(STATE) TOGGLE(E1_STEP_PIN); } while(0)
#else #else
#define E1_STEP_WRITE(STATE) WRITE(E1_STEP_PIN,STATE) #define E1_STEP_WRITE(STATE) WRITE(E1_STEP_PIN,STATE)
@ -496,7 +498,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E2_DIR_READ READ(E2_DIR_PIN) #define E2_DIR_READ READ(E2_DIR_PIN)
#endif #endif
#define E2_STEP_INIT SET_OUTPUT(E2_STEP_PIN) #define E2_STEP_INIT SET_OUTPUT(E2_STEP_PIN)
#if AXIS_IS_TMC(E2) && ENABLED(SQUARE_WAVE_STEPPING) #if AXIS_HAS_SQUARE_WAVE(E2)
#define E2_STEP_WRITE(STATE) do { if(STATE) TOGGLE(E2_STEP_PIN); } while(0) #define E2_STEP_WRITE(STATE) do { if(STATE) TOGGLE(E2_STEP_PIN); } while(0)
#else #else
#define E2_STEP_WRITE(STATE) WRITE(E2_STEP_PIN,STATE) #define E2_STEP_WRITE(STATE) WRITE(E2_STEP_PIN,STATE)
@ -535,7 +537,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E3_DIR_READ READ(E3_DIR_PIN) #define E3_DIR_READ READ(E3_DIR_PIN)
#endif #endif
#define E3_STEP_INIT SET_OUTPUT(E3_STEP_PIN) #define E3_STEP_INIT SET_OUTPUT(E3_STEP_PIN)
#if AXIS_IS_TMC(E3) && ENABLED(SQUARE_WAVE_STEPPING) #if AXIS_HAS_SQUARE_WAVE(E3)
#define E3_STEP_WRITE(STATE) do { if(STATE) TOGGLE(E3_STEP_PIN); } while(0) #define E3_STEP_WRITE(STATE) do { if(STATE) TOGGLE(E3_STEP_PIN); } while(0)
#else #else
#define E3_STEP_WRITE(STATE) WRITE(E3_STEP_PIN,STATE) #define E3_STEP_WRITE(STATE) WRITE(E3_STEP_PIN,STATE)
@ -574,7 +576,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E4_DIR_READ READ(E4_DIR_PIN) #define E4_DIR_READ READ(E4_DIR_PIN)
#endif #endif
#define E4_STEP_INIT SET_OUTPUT(E4_STEP_PIN) #define E4_STEP_INIT SET_OUTPUT(E4_STEP_PIN)
#if AXIS_IS_TMC(E4) && ENABLED(SQUARE_WAVE_STEPPING) #if AXIS_HAS_SQUARE_WAVE(E4)
#define E4_STEP_WRITE(STATE) do { if(STATE) TOGGLE(E4_STEP_PIN); } while(0) #define E4_STEP_WRITE(STATE) do { if(STATE) TOGGLE(E4_STEP_PIN); } while(0)
#else #else
#define E4_STEP_WRITE(STATE) WRITE(E4_STEP_PIN,STATE) #define E4_STEP_WRITE(STATE) WRITE(E4_STEP_PIN,STATE)
@ -613,7 +615,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E5_DIR_READ READ(E5_DIR_PIN) #define E5_DIR_READ READ(E5_DIR_PIN)
#endif #endif
#define E5_STEP_INIT SET_OUTPUT(E5_STEP_PIN) #define E5_STEP_INIT SET_OUTPUT(E5_STEP_PIN)
#if AXIS_IS_TMC(E5) && ENABLED(SQUARE_WAVE_STEPPING) #if AXIS_HAS_SQUARE_WAVE(E5)
#define E5_STEP_WRITE(STATE) do { if(STATE) TOGGLE(E5_STEP_PIN); } while(0) #define E5_STEP_WRITE(STATE) do { if(STATE) TOGGLE(E5_STEP_PIN); } while(0)
#else #else
#define E5_STEP_WRITE(STATE) WRITE(E5_STEP_PIN,STATE) #define E5_STEP_WRITE(STATE) WRITE(E5_STEP_PIN,STATE)