Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion klippy/extras/heaters.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ def __init__(self, config, sensor):
self.mcu_pwm.setup_max_duration(MAX_HEAT_TIME)
# Load additional modules
self.printer.load_object(config, "verify_heater %s" % (short_name,))
self.printer.load_object(config, "pid_calibrate")
# Register PID_CALIBRATE before gcode macros rename commands at connect
pid_calibrate = self.printer.load_object(config, "pid_calibrate")
pid_calibrate.register_heater(short_name)
gcode = self.printer.lookup_object("gcode")
gcode.register_mux_command("SET_HEATER_TEMPERATURE", "HEATER",
short_name, self.cmd_SET_HEATER_TEMPERATURE,
Expand Down
14 changes: 4 additions & 10 deletions klippy/extras/pid_calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@
class PIDCalibrate:
def __init__(self, config):
self.printer = config.get_printer()
self.printer.register_event_handler("klippy:connect",
self._handle_connect)
def _handle_connect(self):
def register_heater(self, heater_name):
gcode = self.printer.lookup_object('gcode')
pheaters = self.printer.lookup_object('heaters')
all_heaters = pheaters.get_all_heaters()
for name in all_heaters:
short_name = name.split()[-1]
gcode.register_mux_command('PID_CALIBRATE', 'HEATER', short_name,
self.cmd_PID_CALIBRATE,
desc=self.cmd_PID_CALIBRATE_help)
gcode.register_mux_command('PID_CALIBRATE', 'HEATER', heater_name,
self.cmd_PID_CALIBRATE,
desc=self.cmd_PID_CALIBRATE_help)
cmd_PID_CALIBRATE_help = "Run PID calibration test"
def cmd_PID_CALIBRATE(self, gcmd):
heater_name = gcmd.get('HEATER')
Expand Down
Loading