From f4ea5f0632d8108557f60d716bf6b308bb91e4bd Mon Sep 17 00:00:00 2001 From: WHPThomas Date: Tue, 23 Apr 2013 01:16:40 +1000 Subject: [PATCH] Fixed broken G92 --- gpx.c | 73 +++++++++++++++++++++++------------------------------------ gpx.h | 2 +- 2 files changed, 29 insertions(+), 46 deletions(-) diff --git a/gpx.c b/gpx.c index 62e40b1..a61ef1c 100644 --- a/gpx.c +++ b/gpx.c @@ -664,53 +664,19 @@ static int calculate_target_position(void) targetPosition.z = currentPosition.z; } - // we treat E as short hand for A or B being set, depending on the state of the currentExtruder - - if(command.flag & E_IS_SET) { - if(currentExtruder == 0) { - // a = e - targetPosition.a = isRelative ? (currentPosition.a + command.e) : command.e; - command.flag |= A_IS_SET; - command.a = command.e; - - // b - if(command.flag & B_IS_SET) { - targetPosition.b = isRelative ? (currentPosition.b + command.b) : command.b; - } - else { - targetPosition.b = currentPosition.b; - } - } - else { - // a - if(command.flag & A_IS_SET) { - targetPosition.a = isRelative ? (currentPosition.a + command.a) : command.a; - } - else { - targetPosition.a = currentPosition.a; - } - - // b = e - targetPosition.b = isRelative ? (currentPosition.b + command.e) : command.e; - command.flag |= B_IS_SET; - command.b = command.e; - } + // a + if(command.flag & A_IS_SET) { + targetPosition.a = isRelative ? (currentPosition.a + command.a) : command.a; } else { - // a - if(command.flag & A_IS_SET) { - targetPosition.a = isRelative ? (currentPosition.a + command.a) : command.a; - } - else { - targetPosition.a = currentPosition.a; - } - // b - if(command.flag & B_IS_SET) { - targetPosition.b = isRelative ? (currentPosition.b + command.b) : command.b; - } - else { - targetPosition.b = currentPosition.b; - } + targetPosition.a = currentPosition.a; + } + // b + if(command.flag & B_IS_SET) { + targetPosition.b = isRelative ? (currentPosition.b + command.b) : command.b; + } + else { + targetPosition.b = currentPosition.b; } // update current feedrate @@ -2144,6 +2110,21 @@ int main(int argc, char * argv[]) } } + // we treat E as short hand for A or B being set, depending on the state of the currentExtruder + + if(command.flag & E_IS_SET) { + if(currentExtruder == 0) { + // a = e + command.flag |= A_IS_SET; + command.a = command.e; + } + else { + // b = e + command.flag |= B_IS_SET; + command.b = command.e; + } + } + // APPLY ANY TOOL CHANGES if(command.flag & T_IS_SET && !dittoPrinting) { @@ -2369,6 +2350,7 @@ int main(int argc, char * argv[]) // G161 - Home given axes to minimum case 161: + if(command.flag & F_IS_SET) currentFeedrate = command.f; home_axes(ENDSTOP_IS_MIN); command_emitted++; positionKnown = 0; @@ -2379,6 +2361,7 @@ int main(int argc, char * argv[]) // G162 - Home given axes to maximum case 28: case 162: + if(command.flag & F_IS_SET) currentFeedrate = command.f; home_axes(ENDSTOP_IS_MAX); command_emitted++; positionKnown = 0; diff --git a/gpx.h b/gpx.h index aa2446c..a641023 100644 --- a/gpx.h +++ b/gpx.h @@ -29,7 +29,7 @@ #include -#define GPX_VERSION "0.7 (beta)" +#define GPX_VERSION "0.8 (beta)" /* Nonzero to 'simulate' RPM using 5D, zero to disable */