gcode: Add support for stacked transforms

Add method from pull request #1243 to support stacked transforms.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2019-06-12 07:33:28 -04:00 committed by KevinOConnor
parent 9855354c75
commit 2d7f32584f
1 changed files with 6 additions and 2 deletions

View File

@ -92,13 +92,17 @@ class GCodeParser:
"mux command %s %s %s already registered (%s)" % ( "mux command %s %s %s already registered (%s)" % (
cmd, key, value, prev_values)) cmd, key, value, prev_values))
prev_values[value] = func prev_values[value] = func
def set_move_transform(self, transform): def set_move_transform(self, transform, force=False):
if self.move_transform is not None: if self.move_transform is not None and not force:
raise self.printer.config_error( raise self.printer.config_error(
"G-Code move transform already specified") "G-Code move transform already specified")
old_transform = self.move_transform
if old_transform is None:
old_transform = self.toolhead
self.move_transform = transform self.move_transform = transform
self.move_with_transform = transform.move self.move_with_transform = transform.move
self.position_with_transform = transform.get_position self.position_with_transform = transform.get_position
return old_transform
def stats(self, eventtime): def stats(self, eventtime):
return False, "gcodein=%d" % (self.bytes_read,) return False, "gcodein=%d" % (self.bytes_read,)
def _action_emergency_stop(self, msg="action_emergency_stop"): def _action_emergency_stop(self, msg="action_emergency_stop"):