diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-01-25 11:39:46 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-01-28 12:19:26 -0500 |
commit | f0a754e496ca989bc355555e2c798c362299abc3 (patch) | |
tree | d870a7dea19279de96bafebd8ca759a607ce0333 /klippy | |
parent | 51e1085dbc1227f0ab996f97e78de440bc9ff9dd (diff) | |
download | kutter-f0a754e496ca989bc355555e2c798c362299abc3.tar.gz kutter-f0a754e496ca989bc355555e2c798c362299abc3.tar.xz kutter-f0a754e496ca989bc355555e2c798c362299abc3.zip |
gcode: Add a run_script() helper method to run g-code scripts
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/gcode.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/klippy/gcode.py b/klippy/gcode.py index 36c1250b..0afd3ff1 100644 --- a/klippy/gcode.py +++ b/klippy/gcode.py @@ -179,6 +179,8 @@ class GCodeParser: self.toolhead.wait_moves() self.printer.request_exit() self.is_processing_data = False + def run_script(self, script): + self.process_commands(script.split('\n'), need_ack=False) # Response handling def ack(self, msg=None): if not self.need_ack or self.is_fileinput: @@ -311,16 +313,14 @@ class GCodeParser: e = extruders[index] if self.extruder is e: return - deactivate_gcode = self.extruder.get_activate_gcode(False) - self.process_commands(deactivate_gcode.split('\n'), need_ack=False) + self.run_script(self.extruder.get_activate_gcode(False)) try: self.toolhead.set_extruder(e) except homing.EndstopError as e: raise error(str(e)) self.extruder = e self.reset_last_position() - activate_gcode = self.extruder.get_activate_gcode(True) - self.process_commands(activate_gcode.split('\n'), need_ack=False) + self.run_script(self.extruder.get_activate_gcode(True)) all_handlers = [ 'G1', 'G4', 'G28', 'M18', 'M400', 'G20', 'M82', 'M83', 'G90', 'G91', 'G92', 'M206', 'M220', 'M221', |