From ff9605c082b79f4054d57ee660f909b5b2a90010 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 25 Feb 2019 20:50:34 -0500 Subject: [PATCH] gcode: The set_temp() takes an extruder number not a heater id Commit cf6c5e6f did not fix the shared heater case - a set_temp() request takes the extruder id, not the heater id (nor the gcode sensor id). Signed-off-by: Kevin O'Connor --- klippy/gcode.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/klippy/gcode.py b/klippy/gcode.py index 184f3a81..b7d737c6 100644 --- a/klippy/gcode.py +++ b/klippy/gcode.py @@ -389,18 +389,24 @@ class GCodeParser: eventtime = self.reactor.pause(eventtime + 1.) def set_temp(self, params, is_bed=False, wait=False): temp = self.get_float('S', params, 0.) + heater = None if is_bed: - heater_name = 'heater_bed' - else: - index = self.get_int('T', params, 0, minval=0) - heater_name = 'extruder%d' % (index,) + heater = self.printer.lookup_object('heater_bed', None) + elif 'T' in params: + index = self.get_int('T', params, minval=0) + extruder = self.printer.lookup_object('extruder%d' % (index,), None) + if extruder is not None: + heater = extruder.get_heater() + elif self.extruder is not None: + heater = self.extruder.get_heater() + if heater is None: + if temp > 0.: + self.respond_error("Heater not configured") + return print_time = self.toolhead.get_last_move_time() try: - heater = self.heaters.lookup_heater(heater_name) heater.set_temp(print_time, temp) except heater.error as e: - if not temp: - return raise error(str(e)) if wait and temp: self.bg_temp(heater)