protoloft / klipper_z_calibration

Klipper plugin for self-calibrating z-offset
GNU General Public License v3.0
1.05k stars 151 forks source link

[Feature suggestion] Nozzle wipe on Endstop #122

Closed todstelzer closed 4 months ago

todstelzer commented 1 year ago

I have a suggestion for the macro:

[gcode_macro CALIBRATE_Z] rename_existing: BASE_CALIBRATE_Z gcode: M117 Z-Calibration.. G28 Z CLEANNOZZLE ;nozzle clean script G28 Z G1 Z XX f600 ;Your Z-endstop height +0,1mm G91 {% for in range(6) %} G1 X+1 f60 G1 X-1 {% endfor %} G90 G28 Z G1 Z5 f6000 ;probably not necessary BASECALIBRATE Z M117

With this code the nozzle gets wiped on the Z_Endstop multiple times to get rid of the last bit of filament. Not sure you can call the z_endstop height automaticly.

With this i got 0.02-0.05mm better accuracy.

todstelzer commented 1 year ago

I had some time with it and mod it to set hotend temp using tap macro.

[gcode_macro` NOZZLE_TEMP_GUARD]
gcode:
    {% set PROBE_TEMP = 200 %}
    {% set MIN_TEMP = PROBE_TEMP - 5 %}
    {% set ACTUAL_TEMP = printer.extruder.temperature %}
    {% set TARGET_TEMP = printer.extruder.target %}

    {% if TARGET_TEMP < PROBE_TEMP %}
        { action_respond_info('Extruder temperature target of %.1fC is too low, heating to %.1fC' % (TARGET_TEMP, PROBE_TEMP)) }
        M109 S{PROBE_TEMP}
    {% else %}
        # Temperature target is already low enough, but nozzle may still be too hot.
        {% if ACTUAL_TEMP < MIN_TEMP %}
            { action_respond_info('Extruder temperature %.1fC is still too low, heating until above %.1fC' % (ACTUAL_TEMP, MIN_TEMP)) }
            TEMPERATURE_WAIT SENSOR=extruder MINIMUM={MIN_TEMP}
        {% endif %}
    {% endif %}

[gcode_macro CALIBRATE_Z]
rename_existing: BASE_CALIBRATE_Z
gcode:
    {% set TARGET_TEMP = printer.extruder.target %}
    M117 Z-Calibration..
    SET_VELOCITY_LIMIT ACCEL=5000
    SET_VELOCITY_LIMIT VELOCITY=500
    NOZZLE_TEMP_GUARD
    G28 Z
    CLEAN_NOZZLE
    SET_HEATER_TEMPERATURE HEATER=extruder TARGET=140 ;set hotend to 140c
    G28 Z
    M106 S255 ;Part Fan 100%
    G1 zXXX f600 ;endstop height +0.1mm
    G91
    {% for _ in range(5) %}
    G1 X+1.5 f60
    G1 X-1.5
    {% endfor %}
    G90
    G28 Z
    BASE_CALIBRATE_Z
    M106 S0 ;Part Fan
    SET_HEATER_TEMPERATURE HEATER=extruder TARGET={TARGET_TEMP} ;set previose hotend temp
    G1 Z10 F24000
    G1 X50 Y356
    TEMPERATURE_WAIT SENSOR="temperature_sensor hotend" MINIMUM={(TARGET_TEMP - 5)}
    M117
TitusLabs commented 1 year ago

This is interesting. Glad to see it's working for you. A single movement with the wiggle function is not enough for that?

Common practice would be to use a sex bolt endstop with a spring to build up a little more pressure against the nozzle to squeeze the plastic.

By the way, you can get the endstop position with this statement: printer.configfile.settings['stepper_z'].position_endstop

todstelzer commented 1 year ago

Yeah you can use 0.1mm there. You don´t need the endstop height after all because you are doing a g28 z anyway ^^; There are more moves because the nozzle needs time to cool down. Thats why you can wipe longer. I suggest to use a ceramic heater to heat the nozzle faster to print temp afterwards.