From ae33cb7fa2f31996a00b25d5cfafc723df3c8e96 Mon Sep 17 00:00:00 2001 From: Michael Moon Date: Sat, 9 Apr 2011 09:16:05 +1000 Subject: [PATCH] start implementing absolute E support --- gcode_parse.c | 9 +++++++-- gcode_process.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gcode_parse.c b/gcode_parse.c index c0829c6..e6f811d 100644 --- a/gcode_parse.c +++ b/gcode_parse.c @@ -385,9 +385,14 @@ void gcode_parse_char(uint8_t c) { if (next_target.option_relative) { next_target.target.X = next_target.target.Y = next_target.target.Z = 0; + #ifdef E_ABSOLUTE + next_target.target.E = 0; + #endif } - // E always relative - next_target.target.E = 0; + #ifndef E_ABSOLUTE + // E always relative + next_target.target.E = 0; + #endif } } diff --git a/gcode_process.c b/gcode_process.c index 5edee49..b67b95b 100644 --- a/gcode_process.c +++ b/gcode_process.c @@ -88,6 +88,9 @@ void process_gcode_command() { next_target.target.X += startpoint.X; next_target.target.Y += startpoint.Y; next_target.target.Z += startpoint.Z; + #ifdef E_ABSOLUTE + next_target.target.E += startpoint.E; + #endif } // E ALWAYS relative, otherwise we overflow our registers after only a few layers // next_target.target.E += startpoint.E; @@ -193,7 +196,7 @@ void process_gcode_command() { zero_z(); axisSelected = 1; } - // there's no point in moving E, as E is always relative + // there's no point in moving E, as E has no endstops if (!axisSelected) { zero_x(); @@ -231,7 +234,9 @@ void process_gcode_command() { axisSelected = 1; } if (next_target.seen_E) { - // there's no point in setting E, as E is always relative + #ifdef E_ABSOLUTE + startpoint.E = current_position.E = next_target.target.E; + #endif axisSelected = 1; }