Now to risk really confusing you.
Here is my routine for setting the Z=0 datum - and as I warned you I make use of a lot of different routines that encapsulate commonly used chunks of code.
; ========================= ; === probe_set_z.g BOF === ; ========================= M98 P"check_homed.g" W"probe_set_z.g" X{null} Y{null} Z{null} M291 R"Setting Z=0 Datum" P"Please wait..." S0 M98 P"probe_config.g" ; insure probe is configured M98 P"cancel_mesh_bsteps.g" ; cancel any mesh compensation and zero the baby steps setting M98 P"move_to_z_home.g" ; position at Z home for probing M98 P"probe_to_center.g" ; move probe to bed center G30 ; do single probe - sets Z to probe trigger height M98 P"move_to_z_home.g" ; return to Z home M98 P"tool_to_center.g" ; move tool to back to bed center M291 R"Z=0 Datum has been set" P"OK" T3 ; ========================= ; === probe_set_z.g EOF === ; =========================Don't worry if it makes little sense - if you wish I can explain it all in detail.
Just don't get over whelmed by my approach - I've been doing this work for several years.
Frederick