aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--klippy/extras/pid_calibrate.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/klippy/extras/pid_calibrate.py b/klippy/extras/pid_calibrate.py
index c7a73195..0cad07f5 100644
--- a/klippy/extras/pid_calibrate.py
+++ b/klippy/extras/pid_calibrate.py
@@ -9,20 +9,19 @@ import heaters
class PIDCalibrate:
def __init__(self, config):
self.printer = config.get_printer()
- self.gcode = self.printer.lookup_object('gcode')
- self.gcode.register_command(
- 'PID_CALIBRATE', self.cmd_PID_CALIBRATE,
- desc=self.cmd_PID_CALIBRATE_help)
+ gcode = self.printer.lookup_object('gcode')
+ gcode.register_command('PID_CALIBRATE', self.cmd_PID_CALIBRATE,
+ desc=self.cmd_PID_CALIBRATE_help)
cmd_PID_CALIBRATE_help = "Run PID calibration test"
- def cmd_PID_CALIBRATE(self, params):
- heater_name = self.gcode.get_str('HEATER', params)
- target = self.gcode.get_float('TARGET', params)
- write_file = self.gcode.get_int('WRITE_FILE', params, 0)
+ def cmd_PID_CALIBRATE(self, gcmd):
+ heater_name = gcmd.get('HEATER')
+ target = gcmd.get_float('TARGET')
+ write_file = gcmd.get_int('WRITE_FILE', 0)
pheaters = self.printer.lookup_object('heaters')
try:
heater = pheaters.lookup_heater(heater_name)
except self.printer.config_error as e:
- raise self.gcode.error(str(e))
+ raise gcmd.error(str(e))
self.printer.lookup_object('toolhead').get_last_move_time()
calibrate = ControlAutoTune(heater, target)
old_control = heater.set_control(calibrate)
@@ -38,7 +37,7 @@ class PIDCalibrate:
# Log and report results
Kp, Ki, Kd = calibrate.calc_final_pid()
logging.info("Autotune: final: Kp=%f Ki=%f Kd=%f", Kp, Ki, Kd)
- self.gcode.respond_info(
+ gcmd.respond_info(
"PID parameters: pid_Kp=%.3f pid_Ki=%.3f pid_Kd=%.3f\n"
"The SAVE_CONFIG command will update the printer config file\n"
"with these parameters and restart the printer." % (Kp, Ki, Kd))