G91 ; relative mode G1 Z-250 S1 F1800 ; move Z down until the switch triggers G1 75 F6000 ; go back a few mm G1 S1 z-235 F360 ; move slowly to X axis endstop once more (second pass) G92 Z0 S2 ; tell the firmware that we are at Z=0mm G90 ; back to absolute mode