Eddy: compensate bed_mesh with tap

This is a macro to use Eddy’s tap output as a reference point for the bed mesh.
Bed mesh can be done with scan/rapid_scan/default methods.
There should be zero_reference_position in the config.

The trick is, as bed_mesh is relative to the 0, which is placed at zero_reference_position,
Z position derived from the tap can be used as a reference.

How to use, basically in any order:

BED_MESH_CALIBRATE METHOD=scan ADAPTIVE=1
BED_MESH_ADJ_FROM_TAP
// Or
BED_MESH_ADJ_FROM_TAP
BED_MESH_CALIBRATE METHOD=scan ADAPTIVE=1

The macro:

[gcode_macro _RELOAD_Z_OFFSET_FROM_PROBE]
gcode:
    {% set Z = printer.toolhead.position.z %}
    M118 Z adjust {Z} -> {Z - printer.probe.last_probe_position.z}
    SET_KINEMATIC_POSITION Z={Z - printer.probe.last_probe_position.z}

[gcode_macro SET_Z_FROM_PROBE]
gcode:
    {% set METHOD = params.METHOD | default("automatic") %}
    {% set SAMPLES = params.SAMPLES | default(3) %}
    {% set PROBE_SPEED = params.PROBE_SPEED | default(4) %}
    {% set LIFT_SPEED = params.LIFT_SPEED | default(5) %}
    {% set SAMPLE_RETRACT_DIST = params.SAMPLE_RETRACT_DIST | default(2) %}
    PROBE METHOD={METHOD} SAMPLES={SAMPLES} PROBE_SPEED={PROBE_SPEED} LIFT_SPEED={LIFT_SPEED} SAMPLE_RETRACT_DIST={SAMPLE_RETRACT_DIST}
    _RELOAD_Z_OFFSET_FROM_PROBE
    G0 Z5

[gcode_macro BED_MESH_ADJ_FROM_TAP]
gcode:
	{% set is_absolute = printer.gcode_move.absolute_coordinates %}
	{% set zero_coords = printer.configfile.settings.bed_mesh.zero_reference_position %}
	M118 {zero_coords[0]} {zero_coords[1]}
	G90
	G0 Z5 F300 # Z-Hop
	G0 X{zero_coords[0]} Y{zero_coords[1]} F3000
	SET_Z_FROM_PROBE METHOD=tap
	G0 Z5 F300 # Z-Hop
	{% if not is_absolute %}
	G91
	{% endif %}

I’ve tested by setting zero reference to 50, 50, and BED_MESH_CALIBRATE METHOD=scan MESH_MIN=300,300
So, bed mesh happens at the further right corner, then the toolhead goes to zero_ref X - x_offset, Y - y_offset.

So, upon BED_MESH_ADJ_FROM_TAP, nozzle moves to zero_ref X, Y; taps & updates current Z with tap’s data.

Basically, that is it.


Cross-linking:

2 Likes

Hi

Many thanks for your hard work on this! I am trying to use a Sovol Original eddy probe on an SV08. I have got the actual tap working with tweaks to the divisor etc.

I believe this Macro is this missing “secret sauce” to set zoffset from the probe to work with bed mesh.

Just a but confused on why you are using 50,50 as the zero reference and dont uderstand this in relation to 300,300 on MIN_MESH. I actually understood that you MUST specify both MAX_MESH and MIN_MESH to be a valid command??

Can you elaborate on these positions and how they relate?

Could the Zero reference point be the centre of the bed i.e. 175,175?

I’m a bit lost!

Krs

Mark

Ah, it is simply to prove the order of things, so if one tries to reproduce/check the macro, one can see that bed mesh happens in one corner, and after that, the probe goes to the zero_reference_point.

You don’t need to do that (reproduce the proof and behavior) to use the macro.

Could the Zero reference point be the centre of the bed i.e. 175,175?

So, you can set whatever zero_reference_point and just use bed mesh as you like (I guess, with ADAPTIVE=1, which internally sets MIN/MAX automatically).

Hope that helps,
-Timofey