pid_calibrate: Avoid internal error on a shutdown
If a shutdown occurs during a PID_CALIBRATE command (eg, due to a heater problem) then exit cleanly instead of throwing an internal error. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
35bbd989e4
commit
c4de0bba50
|
@ -34,6 +34,8 @@ class PIDCalibrate:
|
||||||
heater.set_control(old_control)
|
heater.set_control(old_control)
|
||||||
if write_file:
|
if write_file:
|
||||||
calibrate.write_file('/tmp/heattest.txt')
|
calibrate.write_file('/tmp/heattest.txt')
|
||||||
|
if calibrate.check_busy(0., 0., 0.):
|
||||||
|
raise gcmd.error("pid_calibrate interrupted")
|
||||||
# Log and report results
|
# Log and report results
|
||||||
Kp, Ki, Kd = calibrate.calc_final_pid()
|
Kp, Ki, Kd = calibrate.calc_final_pid()
|
||||||
logging.info("Autotune: final: Kp=%f Ki=%f Kd=%f", Kp, Ki, Kd)
|
logging.info("Autotune: final: Kp=%f Ki=%f Kd=%f", Kp, Ki, Kd)
|
||||||
|
|
Loading…
Reference in New Issue