gcode: A set temperature request should use the heater name, not the gcode id
When setting a temperature, lookup the heater via self.heaters.lookup_heater() and do not use the gcode ids. This fixes temperature setting when multiple extruders share the same heater. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
13b2e091b8
commit
cf6c5e6f18
|
@ -389,22 +389,18 @@ 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 = self.heaters.get_heater_by_gcode_id('B')
|
||||
elif 'T' in params:
|
||||
index = self.get_int('T', params, minval=0)
|
||||
heater = self.heaters.get_heater_by_gcode_id('T%d' % (index,))
|
||||
heater_name = 'heater_bed'
|
||||
else:
|
||||
heater = self.heaters.get_heater_by_gcode_id('T0')
|
||||
if heater is None:
|
||||
if temp > 0.:
|
||||
self.respond_error("Heater not configured")
|
||||
return
|
||||
index = self.get_int('T', params, 0, minval=0)
|
||||
heater_name = 'extruder%d' % (index,)
|
||||
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)
|
||||
|
|
|
@ -265,18 +265,13 @@ class PrinterHeaters:
|
|||
raise self.printer.config_error("Unknown temperature sensor '%s'" % (
|
||||
sensor_type,))
|
||||
return self.sensors[sensor_type](config)
|
||||
def get_all_heaters(self):
|
||||
return self.heaters.values()
|
||||
cmd_TURN_OFF_HEATERS_help = "Turn off all heaters"
|
||||
def cmd_TURN_OFF_HEATERS(self, params):
|
||||
print_time = self.printer.lookup_object('toolhead').get_last_move_time()
|
||||
for heater in self.heaters.values():
|
||||
heater.set_temp(print_time, 0.)
|
||||
def get_all_heaters(self):
|
||||
return self.heaters.values()
|
||||
def get_heater_by_gcode_id(self, gcode_id):
|
||||
if gcode_id in self.heaters_gcode_id:
|
||||
heater_name = self.heaters_gcode_id[gcode_id]
|
||||
return self.heaters[heater_name]
|
||||
return None
|
||||
|
||||
def add_printer_objects(config):
|
||||
config.get_printer().add_object('heater', PrinterHeaters(config))
|
||||
|
|
Loading…
Reference in New Issue