From 4bddf3452fd0a9ab2e060b202d295aa3fc3990a6 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Thu, 7 Oct 2010 20:24:07 +0200 Subject: [PATCH] Move stepper macros from config.h(.dist) to dda.c, as they're not meant to be configured by the user. --- config.h.dist | 58 ------------------------------------------------ dda.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 58 deletions(-) diff --git a/config.h.dist b/config.h.dist index fb05bc5..dc90383 100644 --- a/config.h.dist +++ b/config.h.dist @@ -183,57 +183,6 @@ firmware build options #define UM_PER_STEP_Z ((uint32_t) ((1000.0 / STEPS_PER_MM_Z) + 0.5)) #define UM_PER_STEP_E ((uint32_t) ((1000.0 / STEPS_PER_MM_E) + 0.5)) - -/* - X Stepper -*/ - -#define _x_step(st) WRITE(X_STEP_PIN, st) -#define x_step() _x_step(1); -#define x_direction(dir) WRITE(X_DIR_PIN, dir) -#define x_min() READ(X_MIN_PIN) -#ifdef X_MAX_PIN - #define x_max() READ(X_MAX_PIN) -#else - #define x_max() (0) -#endif - -/* - Y Stepper -*/ - -#define _y_step(st) WRITE(Y_STEP_PIN, st) -#define y_step() _y_step(1); -#define y_direction(dir) WRITE(Y_DIR_PIN, dir) -#define y_min() READ(Y_MIN_PIN) -#ifdef Y_MAX_PIN - #define y_max() READ(Y_MAX_PIN) -#else - #define y_max() (0) -#endif - -/* - Z Stepper -*/ - -#define _z_step(st) WRITE(Z_STEP_PIN, st) -#define z_step() _z_step(1); -#define z_direction(dir) WRITE(Z_DIR_PIN, dir) -#define z_min() READ(Z_MIN_PIN) -#ifdef Z_MAX_PIN - #define z_max() READ(Z_MAX_PIN) -#else - #define z_max() (0) -#endif - -/* - Extruder -*/ - -#define _e_step(st) WRITE(E_STEP_PIN, st) -#define e_step() _e_step(1); -#define e_direction(dir) WRITE(E_DIR_PIN, dir) - /* Heater */ @@ -279,11 +228,4 @@ firmware build options #define power_off() if (0) {} #endif -/* - End Step - All Steppers - (so we don't have to delay in interrupt context) -*/ - -#define unstep() do { _x_step(0); _y_step(0); _z_step(0); _e_step(0); } while (0) - #endif /* _CONFIG_H */ diff --git a/dda.c b/dda.c index 454ee84..5cf6f5a 100644 --- a/dda.c +++ b/dda.c @@ -10,6 +10,67 @@ #include "debug.h" #include "sersendf.h" +/* + X Stepper +*/ + +#define _x_step(st) WRITE(X_STEP_PIN, st) +#define x_step() _x_step(1); +#define x_direction(dir) WRITE(X_DIR_PIN, dir) +#define x_min() READ(X_MIN_PIN) +#ifdef X_MAX_PIN + #define x_max() READ(X_MAX_PIN) +#else + #define x_max() (0) +#endif + +/* + Y Stepper +*/ + +#define _y_step(st) WRITE(Y_STEP_PIN, st) +#define y_step() _y_step(1); +#define y_direction(dir) WRITE(Y_DIR_PIN, dir) +#define y_min() READ(Y_MIN_PIN) +#ifdef Y_MAX_PIN + #define y_max() READ(Y_MAX_PIN) +#else + #define y_max() (0) +#endif + +/* + Z Stepper +*/ + +#define _z_step(st) WRITE(Z_STEP_PIN, st) +#define z_step() _z_step(1); +#define z_direction(dir) WRITE(Z_DIR_PIN, dir) +#define z_min() READ(Z_MIN_PIN) +#ifdef Z_MAX_PIN + #define z_max() READ(Z_MAX_PIN) +#else + #define z_max() (0) +#endif + +/* + Extruder +*/ + +#define _e_step(st) WRITE(E_STEP_PIN, st) +#define e_step() _e_step(1); +#define e_direction(dir) WRITE(E_DIR_PIN, dir) + +/* + End Step - All Steppers + (so we don't have to delay in interrupt context) +*/ + +#define unstep() do { _x_step(0); _y_step(0); _z_step(0); _e_step(0); } while (0) + +/* + Maths +*/ + #ifndef ABS #define ABS(v) (((v) >= 0)?(v):(-(v))) #endif