From be91c1229fdc8aae5f18549c6f565f33b32b4719 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 12 Mar 2017 22:02:32 -0400 Subject: gcode: Eliminate build_config() method Lookup the printer components during the set_printer_ready() callback. Signed-off-by: Kevin O'Connor --- klippy/gcode.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'klippy/gcode.py') diff --git a/klippy/gcode.py b/klippy/gcode.py index e0bf6aa9..56a5f746 100644 --- a/klippy/gcode.py +++ b/klippy/gcode.py @@ -34,15 +34,16 @@ class GCodeParser: self.homing_add = [0.0, 0.0, 0.0, 0.0] self.axis2pos = {'X': 0, 'Y': 1, 'Z': 2, 'E': 3} self.build_handlers() - def build_config(self): - self.toolhead = self.printer.objects['toolhead'] + def build_handlers(self): + # Lookup printer components + self.toolhead = self.printer.objects.get('toolhead') self.heater_nozzle = None extruder = self.printer.objects.get('extruder') if extruder: self.heater_nozzle = extruder.heater self.heater_bed = self.printer.objects.get('heater_bed') self.fan = self.printer.objects.get('fan') - def build_handlers(self): + # Map command handlers handlers = ['G1', 'G4', 'G20', 'G21', 'G28', 'G90', 'G91', 'G92', 'M18', 'M82', 'M83', 'M105', 'M110', 'M112', 'M114', 'M115', 'M206', 'M400', -- cgit v1.2.3-70-g09d2