diff --git a/klippy/extras/display/menu.cfg b/klippy/extras/display/menu.cfg index 1e9c12dc..3429e49e 100644 --- a/klippy/extras/display/menu.cfg +++ b/klippy/extras/display/menu.cfg @@ -222,30 +222,36 @@ items: [menu __control __move_10mm __axis_x] type: input name: "X:{0:05.1f} " -parameter: toolhead.xpos +parameter: gcode.move_xpos input_min: 0 input_max: 200.0 input_step: 10.0 -gcode: G1 X{0:.1f} +gcode: + G90 + G1 X{0:.1f} [menu __control __move_10mm __axis_y] type: input name: "Y:{0:05.1f} " -parameter: toolhead.ypos +parameter: gcode.move_ypos input_min: 0 input_max: 200.0 input_step: 10.0 -gcode: G1 Y{0:.1f} +gcode: + G90 + G1 Y{0:.1f} [menu __control __move_10mm __axis_z] type: input enable: !toolhead.is_printing name: "Move Z:{0:05.1f}" -parameter: toolhead.zpos +parameter: gcode.move_zpos input_min: 0 input_max: 200.0 input_step: 10.0 -gcode: G1 Z{0:.1f} +gcode: + G90 + G1 Z{0:.1f} [menu __control __move_10mm __axis_e] type: input @@ -255,7 +261,9 @@ parameter: 0 input_min: -50.0 input_max: 50.0 input_step: 10.0 -gcode: G1 E{0:.1f} F240 +gcode: + M83 + G1 E{0:.1f} F240 ### menu move 1mm ### [menu __control __move_1mm] @@ -270,30 +278,36 @@ items: [menu __control __move_1mm __axis_x] type: input name: "X:{0:05.1f} " -parameter: toolhead.xpos +parameter: gcode.move_xpos input_min: 0 input_max: 200.0 input_step: 1.0 -gcode: G1 X{0:.1f} +gcode: + G90 + G1 X{0:.1f} [menu __control __move_1mm __axis_y] type: input name: "Y:{0:05.1f} " -parameter: toolhead.ypos +parameter: gcode.move_ypos input_min: 0 input_max: 200.0 input_step: 1.0 -gcode: G1 Y{0:.1f} +gcode: + G90 + G1 Y{0:.1f} [menu __control __move_1mm __axis_z] type: input enable: !toolhead.is_printing name: "Move Z:{0:05.1f}" -parameter: toolhead.zpos +parameter: gcode.move_zpos input_min: 0 input_max: 200.0 input_step: 1.0 -gcode: G1 Z{0:.1f} +gcode: + G90 + G1 Z{0:.1f} [menu __control __move_1mm __axis_e] type: input @@ -303,7 +317,9 @@ parameter: 0 input_min: -50.0 input_max: 50.0 input_step: 1.0 -gcode: G1 E{0:.1f} F240 +gcode: + M83 + G1 E{0:.1f} F240 ### menu move 0.1mm ### [menu __control __move_01mm] @@ -318,30 +334,36 @@ items: [menu __control __move_01mm __axis_x] type: input name: "X:{0:05.1f} " -parameter: toolhead.xpos +parameter: gcode.move_xpos input_min: 0 input_max: 200.0 input_step: 0.1 -gcode: G1 X{0:.1f} +gcode: + G90 + G1 X{0:.1f} [menu __control __move_01mm __axis_y] type: input name: "Y:{0:05.1f} " -parameter: toolhead.ypos +parameter: gcode.move_ypos input_min: 0 input_max: 200.0 input_step: 0.1 -gcode: G1 Y{0:.1f} +gcode: + G90 + G1 Y{0:.1f} [menu __control __move_01mm __axis_z] type: input enable: !toolhead.is_printing name: "Move Z:{0:05.1f}" -parameter: toolhead.zpos +parameter: gcode.move_zpos input_min: 0 input_max: 200.0 input_step: 0.1 -gcode: G1 Z{0:.1f} +gcode: + G90 + G1 Z{0:.1f} [menu __control __move_01mm __axis_e] type: input @@ -351,7 +373,9 @@ parameter: 0 input_min: -50.0 input_max: 50.0 input_step: 0.1 -gcode: G1 E{0:.1f} F240 +gcode: + M83 + G1 E{0:.1f} F240 ### menu temperature ### [menu __temp] @@ -542,9 +566,11 @@ gcode: [menu __filament __feed] type: input name: Feed Filament: {0:.1f} -parameter: toolhead.epos +parameter: 0 input_step: 0.1 -gcode: G1 E{0:.1f} F30 +gcode: + M83 + G1 E{0:.1f} F30 ### menu prepare ### [menu __prepare] diff --git a/klippy/gcode.py b/klippy/gcode.py index 8cddde9f..8dc235d0 100644 --- a/klippy/gcode.py +++ b/klippy/gcode.py @@ -102,7 +102,12 @@ class GCodeParser: self.position_with_transform = transform.get_position def stats(self, eventtime): return False, "gcodein=%d" % (self.bytes_read,) + def get_current_position(self): + p = [lp - bp for lp, bp in zip(self.last_position, self.base_position)] + p[3] /= self.extrude_factor + return p def get_status(self, eventtime): + move_position = self.get_current_position() busy = self.is_processing_data return { 'speed_factor': self.speed_factor * 60., @@ -110,6 +115,10 @@ class GCodeParser: 'extrude_factor': self.extrude_factor, 'abs_extrude': self.absoluteextrude, 'busy': busy, + 'move_xpos': move_position[0], + 'move_ypos': move_position[1], + 'move_zpos': move_position[2], + 'move_epos': move_position[3], 'last_xpos': self.last_position[0], 'last_ypos': self.last_position[1], 'last_zpos': self.last_position[2], @@ -573,8 +582,7 @@ class GCodeParser: cmd_M114_when_not_ready = True def cmd_M114(self, params): # Get Current Position - p = [lp - bp for lp, bp in zip(self.last_position, self.base_position)] - p[3] /= self.extrude_factor + p = self.get_current_position() self.respond("X:%.3f Y:%.3f Z:%.3f E:%.3f" % tuple(p)) def cmd_M220(self, params): # Set speed factor override percentage