From 8acb072e0b1b5ad4d89bcab9df9f554ba1f4d160 Mon Sep 17 00:00:00 2001 From: Stephan Walter Date: Sat, 26 Feb 2011 14:03:45 +0100 Subject: [PATCH] Actually set extruder enable pin if defined --- dda.c | 2 ++ gcode_process.c | 3 +++ pinio.c | 3 +++ pinio.h | 11 +++++++++++ 4 files changed, 19 insertions(+) diff --git a/dda.c b/dda.c index 6a3f470..131c7fa 100644 --- a/dda.c +++ b/dda.c @@ -183,6 +183,7 @@ void dda_create(DDA *dda, TARGET *target) { y_enable(); if (dda->z_delta) z_enable(); + e_enable(); // since it's unusual to combine X, Y and Z changes in a single move on reprap, check if we can use simpler approximations before trying the full 3d approximation. if (dda->z_delta == 0) @@ -363,6 +364,7 @@ void dda_start(DDA *dda) { y_enable(); if (dda->z_delta) z_enable(); + e_enable(); // set direction outputs x_direction(dda->x_direction); diff --git a/gcode_process.c b/gcode_process.c index 6ca5f81..cbaa06b 100644 --- a/gcode_process.c +++ b/gcode_process.c @@ -273,6 +273,7 @@ void process_gcode_command() { x_disable(); y_disable(); z_disable(); + e_disable(); power_off(); for (;;) wd_reset(); @@ -439,6 +440,7 @@ void process_gcode_command() { x_enable(); y_enable(); z_enable(); + e_enable(); steptimeout = 0; break; // M191- power off @@ -446,6 +448,7 @@ void process_gcode_command() { x_disable(); y_disable(); z_disable(); + e_disable(); power_off(); break; diff --git a/pinio.c b/pinio.c index 0abccd7..68f542a 100644 --- a/pinio.c +++ b/pinio.c @@ -10,6 +10,9 @@ void power_off() { #ifdef Z_ENABLE_PIN z_disable(); #endif + #ifdef E_ENABLE_PIN + e_disable(); + #endif #ifdef STEPPER_ENABLE_PIN WRITE(STEPPER_ENABLE_PIN, STEPPER_ENABLE_INVERT ^ 1); diff --git a/pinio.h b/pinio.h index 6eb0ca0..d8ffed3 100644 --- a/pinio.h +++ b/pinio.h @@ -45,6 +45,9 @@ #ifndef E_INVERT_DIR #define E_INVERT_DIR 0 #endif +#ifndef E_INVERT_ENABLE + #define E_INVERT_ENABLE 0 +#endif #ifndef STEPPER_ENABLE_INVERT #define STEPPER_ENABLE_INVERT 0 @@ -165,4 +168,12 @@ Stepper Enable Pins #define z_disable() do { } while (0) #endif +#ifdef E_ENABLE_PIN + #define e_enable() do { WRITE(E_ENABLE_PIN, E_INVERT_ENABLE); SET_OUTPUT(E_ENABLE_PIN); } while (0) + #define e_disable() do { WRITE(E_ENABLE_PIN, E_INVERT_ENABLE ^ 1); SET_OUTPUT(E_ENABLE_PIN); } while (0) +#else + #define e_enable() do { } while (0) + #define e_disable() do { } while (0) +#endif + #endif /* _PINIO_H */