mirror of https://github.com/Desuuuu/klipper.git
gcode_arcs: Fix Z moves and E moves
Fix Z moves so that the movement is spaced out among the arc movements. Fix extrude moves when in absolute extrude mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
ff28f33967
commit
402110f655
|
@ -22,12 +22,15 @@ class ArcSupport:
|
||||||
self.gcode.register_command("G3", self.cmd_G2)
|
self.gcode.register_command("G3", self.cmd_G2)
|
||||||
|
|
||||||
def cmd_G2(self, params):
|
def cmd_G2(self, params):
|
||||||
currentPos = self.gcode.get_status(None)['gcode_position']
|
gcodestatus = self.gcode.get_status(None)
|
||||||
|
if not gcodestatus['absolute_coordinates']:
|
||||||
|
raise self.gcode.error("G2/G3 does not support relative move mode")
|
||||||
|
currentPos = gcodestatus['gcode_position']
|
||||||
|
|
||||||
# Parse parameters
|
# Parse parameters
|
||||||
asX = self.gcode.get_float("X", params)
|
asX = self.gcode.get_float("X", params, currentPos[0])
|
||||||
asY = self.gcode.get_float("Y", params)
|
asY = self.gcode.get_float("Y", params, currentPos[1])
|
||||||
asZ = self.gcode.get_float("Z", params, None)
|
asZ = self.gcode.get_float("Z", params, currentPos[2])
|
||||||
if self.gcode.get_float("R", params, None) is not None:
|
if self.gcode.get_float("R", params, None) is not None:
|
||||||
raise self.gcode.error("G2/G3 does not support R moves")
|
raise self.gcode.error("G2/G3 does not support R moves")
|
||||||
asI = self.gcode.get_float("I", params, 0.)
|
asI = self.gcode.get_float("I", params, 0.)
|
||||||
|
@ -39,20 +42,23 @@ class ArcSupport:
|
||||||
clockwise = (params['#command'] == 'G2')
|
clockwise = (params['#command'] == 'G2')
|
||||||
|
|
||||||
# Build list of linear coordinates to move to
|
# Build list of linear coordinates to move to
|
||||||
coords = self.planArc(currentPos, [asX, asY, 0., 0.], [asI, asJ],
|
coords = self.planArc(currentPos, [asX, asY, asZ], [asI, asJ],
|
||||||
clockwise)
|
clockwise)
|
||||||
if not coords:
|
if not coords:
|
||||||
self.gcode.respond_info("G2/G3 could not translate '%s'"
|
self.gcode.respond_info("G2/G3 could not translate '%s'"
|
||||||
% (params['#original'],))
|
% (params['#original'],))
|
||||||
return
|
return
|
||||||
|
e_per_move = e_base = 0.
|
||||||
|
if asE is not None:
|
||||||
|
if gcodestatus['absolute_extrude']:
|
||||||
|
e_base = currentPos[3]
|
||||||
|
e_per_move = (asE - e_base) / len(coords)
|
||||||
|
|
||||||
# Convert coords into G1 commands
|
# Convert coords into G1 commands
|
||||||
for coord in coords:
|
for coord in coords:
|
||||||
g1_params = {'X': coord[0], 'Y': coord[1]}
|
g1_params = {'X': coord[0], 'Y': coord[1], 'Z': coord[2]}
|
||||||
if asZ is not None:
|
if e_per_move:
|
||||||
g1_params['Z'] = asZ
|
g1_params['E'] = e_base + e_per_move
|
||||||
if asE is not None:
|
|
||||||
g1_params['E'] = asE / len(coords)
|
|
||||||
if asF is not None:
|
if asF is not None:
|
||||||
g1_params['F'] = asF
|
g1_params['F'] = asF
|
||||||
self.gcode.cmd_G1(g1_params)
|
self.gcode.cmd_G1(g1_params)
|
||||||
|
|
|
@ -140,7 +140,8 @@ class GCodeParser:
|
||||||
'speed_factor': self._get_gcode_speed_override(),
|
'speed_factor': self._get_gcode_speed_override(),
|
||||||
'speed': self._get_gcode_speed(),
|
'speed': self._get_gcode_speed(),
|
||||||
'extrude_factor': self.extrude_factor,
|
'extrude_factor': self.extrude_factor,
|
||||||
'abs_extrude': self.absolute_extrude,
|
'absolute_coordinates': self.absolute_coord,
|
||||||
|
'absolute_extrude': self.absolute_extrude,
|
||||||
'busy': busy,
|
'busy': busy,
|
||||||
'move_xpos': move_position[0],
|
'move_xpos': move_position[0],
|
||||||
'move_ypos': move_position[1],
|
'move_ypos': move_position[1],
|
||||||
|
|
Loading…
Reference in New Issue