aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-04-24 22:51:06 -0400
committerKevin O'Connor <kevin@koconnor.net>2020-05-05 11:08:11 -0400
commita79096efdf5d4eef82bc415682855d2a546c7595 (patch)
tree14be153128e78ba948334d6a1ebcb485f440caa1 /klippy
parent12b20c6e77bb597f89a3b1df8e00da352c4bbbc5 (diff)
downloadkutter-a79096efdf5d4eef82bc415682855d2a546c7595.tar.gz
kutter-a79096efdf5d4eef82bc415682855d2a546c7595.tar.xz
kutter-a79096efdf5d4eef82bc415682855d2a546c7595.zip
pid_calibrate: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-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))