mirror of
				https://github.com/Klipper3d/klipper.git
				synced 2025-11-03 20:05:49 +01:00 
			
		
		
		
	Introduce a heaters.set_temperature() command and call that from commands that set a heater temperature. This new function calls toolhead.register_lookahead_callback() so that the idle_timeout gets notification that activity has occurred. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
		
			
				
	
	
		
			29 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
# Support for a heated bed
 | 
						|
#
 | 
						|
# Copyright (C) 2018-2019  Kevin O'Connor <kevin@koconnor.net>
 | 
						|
#
 | 
						|
# This file may be distributed under the terms of the GNU GPLv3 license.
 | 
						|
 | 
						|
class PrinterHeaterBed:
 | 
						|
    def __init__(self, config):
 | 
						|
        self.printer = config.get_printer()
 | 
						|
        pheaters = self.printer.load_object(config, 'heaters')
 | 
						|
        self.heater = pheaters.setup_heater(config, 'B')
 | 
						|
        self.get_status = self.heater.get_status
 | 
						|
        self.stats = self.heater.stats
 | 
						|
        # Register commands
 | 
						|
        gcode = self.printer.lookup_object('gcode')
 | 
						|
        gcode.register_command("M140", self.cmd_M140)
 | 
						|
        gcode.register_command("M190", self.cmd_M190)
 | 
						|
    def cmd_M140(self, gcmd, wait=False):
 | 
						|
        # Set Bed Temperature
 | 
						|
        temp = gcmd.get_float('S', 0.)
 | 
						|
        pheaters = self.printer.lookup_object('heaters')
 | 
						|
        pheaters.set_temperature(self.heater, temp, wait)
 | 
						|
    def cmd_M190(self, gcmd):
 | 
						|
        # Set Bed Temperature and Wait
 | 
						|
        self.cmd_M140(gcmd, wait=True)
 | 
						|
 | 
						|
def load_config(config):
 | 
						|
    return PrinterHeaterBed(config)
 |