def main(): hal.init() try: hal.fan_control(True) print("Running for extruder...") try: ep, ei, ed = finder(EXTRUDER_TARGET_TEMPERATURE, hal.get_extruder_temperature, hal.extruder_heater_control) except (IOError, OSError): ep, ei, ed = None, None, None print("Extruder malfunction") hal.extruder_heater_control(0) print("Running for bed...") try: bp, bi, bd = finder(BED_TARGET_TEMPERATURE, hal.get_bed_temperature, hal.bed_heater_control) except (IOError, OSError): bp, bi, bd = None, None, None print("Bed malfunction") print("Done") print("Extruder P={}, I={}, D={}".format(ep, ei, ed)) print("Bed P={}, I={}, D={}".format(bp, bi, bd)) hal.bed_heater_control(0) hal.fan_control(False) except KeyboardInterrupt: pass hal.deinit()
def main(): hal.init() try: hal.fan_control(True) print("Running for extruder...") try: ec, eh = finder(EXTRUDER_MAX_TEMPERATURE, EXTRUDER_DELTA_TEMPERATURE, hal.get_extruder_temperature, hal.extruder_heater_control) except (IOError, OSError): ec, eh = None, None print("Extruder malfunction") hal.extruder_heater_control(0) print("Running for bed...") try: bc, bh = finder(BED_MAX_TEMPERATURE, BED_DELTA_TEMPERATURE, hal.get_bed_temperature, hal.bed_heater_control) except (IOError, OSError): bc, bh = None, None print("Bed malfunction") hal.bed_heater_control(0) print("Done") print("Extruder transfer coefficients, cooling {}, heating {}".format( ec, eh)) print("Bed transfer coefficients, cooling {}, heating {}".format( bc, bh)) hal.fan_control(False) except KeyboardInterrupt: pass hal.deinit()