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) try: heater = extruder.get_printer_heater(self.printer, heater_name) except self.printer.config_error as e: raise self.gcode.error(str(e)) print_time = self.printer.lookup_object( 'toolhead').get_last_move_time() calibrate = ControlAutoTune(heater) old_control = heater.set_control(calibrate) try: heater.set_temp(print_time, target) except heater.error as e: raise self.gcode.error(str(e)) self.gcode.bg_temp(heater) heater.set_control(old_control) if write_file: calibrate.write_file('/tmp/heattest.txt') 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))
def printer_state(self, state): if state == 'connect': self.heater = extruder.get_printer_heater( self.printer, self.heater_name) logging.info("Starting heater checks for %s", self.heater_name) reactor = self.printer.get_reactor() reactor.register_timer(self.check_event, reactor.NOW)
def __init__(self, printer, config): self.fan = PrinterFan(printer, config) heater = config.get("heater", "extruder0") self.heater = extruder.get_printer_heater(printer, heater) if self.heater is None: raise config.error("Unknown heater '%s'" % (heater, )) self.heater_temp = config.getfloat("heater_temp", 50.0) printer.reactor.register_timer(self.callback, printer.reactor.NOW)
def __init__(self, printer, config): self.fan = PrinterFan(printer, config) self.mcu = printer.objects['mcu'] heater = config.get("heater", "extruder0") self.heater = extruder.get_printer_heater(printer, heater) self.heater_temp = config.getfloat("heater_temp", 50.0) max_power = self.fan.max_power self.fan_speed = config.getfloat("fan_speed", max_power, minval=0., maxval=max_power) self.fan.mcu_fan.setup_shutdown_value(max_power) printer.reactor.register_timer(self.callback, printer.reactor.NOW)
def printer_state(self, state): if state == 'ready': self.heater = extruder.get_printer_heater(self.printer, self.heater_name) reactor = self.printer.get_reactor() reactor.register_timer(self.callback, reactor.NOW)
def __init__(self, printer, config): self.fan = PrinterFan(printer, config) heater = config.get("heater", "extruder0") self.heater = extruder.get_printer_heater(printer, heater) self.heater_temp = config.getfloat("heater_temp", 50.0) printer.reactor.register_timer(self.callback, printer.reactor.NOW)