diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-09-17 19:28:07 -0400 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2018-09-25 13:48:46 -0400 |
commit | 5a1b2d61aed628c13d636945327d71eaa9ff510f (patch) | |
tree | 39189a56ee7849584888ccf0d36d9c1c70a94a72 /klippy/extras/pid_calibrate.py | |
parent | 531134f092555f737e7031c1b011fb85cb051f71 (diff) | |
download | kutter-5a1b2d61aed628c13d636945327d71eaa9ff510f.tar.gz kutter-5a1b2d61aed628c13d636945327d71eaa9ff510f.tar.xz kutter-5a1b2d61aed628c13d636945327d71eaa9ff510f.zip |
pid_calibrate: Support saving calibration data via SAVE_CONFIG
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/pid_calibrate.py')
-rw-r--r-- | klippy/extras/pid_calibrate.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/klippy/extras/pid_calibrate.py b/klippy/extras/pid_calibrate.py index b087f2b3..d2413e15 100644 --- a/klippy/extras/pid_calibrate.py +++ b/klippy/extras/pid_calibrate.py @@ -35,12 +35,19 @@ class PIDCalibrate: heater.set_control(old_control) if write_file: calibrate.write_file('/tmp/heattest.txt') + # 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( "PID parameters: pid_Kp=%.3f pid_Ki=%.3f pid_Kd=%.3f\n" - "To use these parameters, update the printer config file with\n" - "the above and then issue a RESTART command" % (Kp, Ki, Kd)) + "The SAVE_CONFIG command will update the printer config file\n" + "with these parameters and restart the printer." % (Kp, Ki, Kd)) + # Store results for SAVE_CONFIG + configfile = self.printer.lookup_object('configfile') + configfile.set(heater_name, 'control', 'pid') + configfile.set(heater_name, 'pid_Kp', "%.3f" % (Kp,)) + configfile.set(heater_name, 'pid_Ki', "%.3f" % (Ki,)) + configfile.set(heater_name, 'pid_Kd', "%.3f" % (Kd,)) TUNE_PID_DELTA = 5.0 |