From c1f2866a9437fe86554bed2794fd00f4f9edbe9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Sat, 2 Mar 2013 13:39:44 +0100 Subject: [PATCH] Moved totalExtrusion calculation into existing branches, added calculation of currentE for relative extruders (in case GCODE switches back to absolute) --- octoprint/util/gcodeInterpreter.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/octoprint/util/gcodeInterpreter.py b/octoprint/util/gcodeInterpreter.py index e272a1f..797d954 100644 --- a/octoprint/util/gcodeInterpreter.py +++ b/octoprint/util/gcodeInterpreter.py @@ -154,16 +154,15 @@ class gcode(object): moveType = 'extrude' if e < currentE: moveType = 'retract' + totalExtrusion += e - currentE + currentE = e else: if e > 0: moveType = 'extrude' if e < 0: moveType = 'retract' - if posAbsExtruder: - totalExtrusion += e - currentE - currentE = e - else: totalExtrusion += e + currentE += e if totalExtrusion > maxExtrusion: maxExtrusion = totalExtrusion if moveType == 'move' and oldPos.z != pos.z: