Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework tap code for faster Z axis and add customizable probe temp for print sheet management #90

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
6 changes: 6 additions & 0 deletions config/tap_QGL.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gcode_macro QUAD_GANTRY_LEVEL]
rename_existing: QUAD_GANTRY_LEVEL_REAL
gcode:
QUAD_GANTRY_LEVEL_REAL
_POST_PROBE
SET_GCODE_VARIABLE MACRO=_TAP_VARIABLES VARIABLE=brushed VALUE=0
62 changes: 20 additions & 42 deletions config/tap_klipper_instructions.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,22 @@
# Updating your Klipper config for Tap

There are a few changes you'll need to make in order to get Tap working properly.

1. Update your Z endstop:

- Under the `[stepper_z]` block, you'll want to comment out your `position_endstop` and change your `endstop_pin` so that it uses the virtual Z endstop for Tap.

- Example: `endstop_pin: probe:z_virtual_endstop`

- Be sure to *also* remove any automatically saved `[stepper_z] position_endstop: ...` value that may be found at the **bottom** of your `printer.cfg`file.

2. Update your Z homing position:

- If you use `[safe_z_home]`, change the location to the center of the bed. If you have a `[homing_override]` make sure that it moves the toolhead to the center of the bed before calling `G28 Z`.

3. Update your probe's offsets:

- Remember, with Tap, your nozzle IS the probe, so your `[probe] x_offset` and `[probe] y_offset` values should be 0 now. You'll need to manually calibrate the probe's Z offset by using `PROBE_CALIBRATE`.

4. Add Tap's `activate_gcode:`

- This G-code will allow you to probe cold, but will also prevent you from probing with a nozzle at printing temperature (to try to preserve your build surface). This goes in the `[probe]` section of your config.

```jinja

activate_gcode:
{% set PROBE_TEMP = 150 %}
{% set MAX_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 high, lowering 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 > MAX_TEMP %}
{ action_respond_info('Extruder temperature %.1fC is still too high, waiting until below %.1fC' % (ACTUAL_TEMP, MAX_TEMP)) }
TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={ MAX_TEMP }
{% endif %}
{% endif %}

```
There are some changes you'll need to make to get Tap working properly.

1. import all the cfg files and include `tap_settings.cfg` into your `printer.cfg`.

2. add the activate and deactivate gcode found at the bottom of the `tap_settings.cfg` to the `[probe]` section in your `printer.cfg`.

3. add `[save_variables]` to your config.

4. replace any instance of `BED_MESH_CALIBRATE` with `BED_MESH_CALIBRATE_PROPER`, this is largely for KAMP compatibility.

After that, you can configure the Z acceleration when probing, the homing position; and the speed multiplier thereof, and turn on the z tilt and QGL macros so that `NOZZLE_BRUSH` works properly. One thing you need to put in as a copy of your config is the default Z acceleration.

## Note make sure to run `SET_PROBE_TEMP` at least once. This sets the minimum probe temp for your print surface and saves it to the variables file. This varies by print surface but there are some general values below

|Surface|Temp range(C)|
|--|--|
|PEI (any)|150-155|
|Polyploplene|100-110|
|Galorite (G10)|130-150|
|Borosilicate Glass|200-230|
79 changes: 79 additions & 0 deletions config/tap_macros.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[gcode_macro _TAP_VARIABLES]
variable_probing: 0
variable_brushed: 0
gcode:

[homing_override]
axes: xyz
gcode:
{% if 'x' not in printer.toolhead.homed_axes %}
G28 X
{% endif %}
{% if 'y' not in printer.toolhead.homed_axes %}
G28 Y
{% endif %}
{% if 'z' not in printer.toolhead.homed_axes %}
G90
M220 S{printer["gcode_macro _TAP_SETTINGS"].home_speed}
G0 X{printer["gcode_macro _TAP_SETTINGS"].home_x} Y{printer["gcode_macro _TAP_SETTINGS"].home_y}
G28 Z
M220 S100
G91
{% endif %}

[gcode_macro _PRE_PROBE_CHECK]
gcode:
{% set svv = printer.save_variables.variables %}
{% set PROBE_TEMP = svv.probe_temp %}
{% set MAX_TEMP = PROBE_TEMP + 5 %}
{% set ACTUAL_TEMP = printer.extruder.temperature %}
{% set TARGET_TEMP = printer.extruder.target %}
{% set PROBE_ACCEL = printer["gcode_macro _TAP_SETTINGS"].probe_accel %}
{% set BRUSHED = printer["gcode_macro _TAP_VARIABLES"].brushed %}
{% if BRUSHED == 1 %}
_PROBE_TEMP_CHECK
{% else %}
NOZZLE_BRUSH
SET_GCODE_VARIABLE MACRO=_TAP_VARIABLES VARIABLE=brushed VALUE=1
_PROBE_TEMP_CHECK
{% endif %}

[gcode_macro _PROBE_TEMP_CHECK]
gcode:
{% set svv = printer.save_variables.variables %}
{% set PROBE_TEMP = svv.probe_temp %}
{% set MAX_TEMP = PROBE_TEMP + 5 %}
{% set ACTUAL_TEMP = printer.extruder.temperature %}
{% set TARGET_TEMP = printer.extruder.target %}
{% set PROBE_ACCEL = printer["gcode_macro _TAP_SETTINGS"].probe_accel %}
SET_KINEMATICS_LIMIT Z_ACCEL={PROBE_ACCEL}
{% if TARGET_TEMP > PROBE_TEMP %}
{ action_respond_info('Extruder temperature target of %.1fC is too high, lowering 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 > MAX_TEMP %}
{ action_respond_info('Extruder temperature %.1fC is still too high, waiting until below %.1fC' % (ACTUAL_TEMP, MAX_TEMP)) }
TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={MAX_TEMP}
{% endif %}
{% endif %}

[gcode_macro _POST_PROBING]
gcode:
SET_KINEMATICS_LIMIT Z_ACCEL={printer["gcode_macro _TAP_SETTINGS"].max_z_accel}

[gcode_macro _POST_PROBE]
gcode:
POST_PROBE
SET_GCODE_VARIABLE MACRO=_TAP_VARIABLES VARIABLE=brushed VALUE=0

[gcode_macro BED_MESH_CALIBRATE_PROPER]
gcode:
BED_MESH_CALIBRATE
_POST_PROBE
SET_GCODE_VARIABLE MACRO=_TAP_VARIABLES VARIABLE=brushed VALUE=0

[gcode_macro SET_PROBE_TEMP]
gcode:
{% set temp = params.TEMP|int %}
SAVE_VARIABLE VARIABLE=probe_temp VALUE={TEMP}
25 changes: 25 additions & 0 deletions config/tap_settings.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[include tap_macros.cfg]

########################
#settings for tap below#
########################

#includes for Z_tilt and QGL
[include tap_z_tilt.cfg]
#[include tap_QGL.cfg]

[gcode_macro _TAP_SETTINGS]
variable_probe_accel: 15 # Z acceleration for probe
variable_home_x: 175 # homing position for Z
variable_home_y: 175
variable_home_speed: 300 #M220 S multiplier
variable_max_z_accel: 500 #accel of your Z axis
gcode:

#make sure to add this to your probe section
#
# activate_gcode:
# _PRE_PROBE_CHECK
# deactivate_gcode:
# _POST_PROBING
#
6 changes: 6 additions & 0 deletions config/tap_z_tilt.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gcode_macro Z_TILT_ADJUST]
rename_existing: Z_TILT_ADJUST_REAL
gcode:
Z_TILT_ADJUST_REAL
_POST_PROBE
SET_GCODE_VARIABLE MACRO=_TAP_VARIABLES VARIABLE=brushed VALUE=0