; homex.g ; called to home the X axis ; M400 ; wait for current moves to finish M574 X1 S3 ; use stall guard for endstop M201 X500 ; reduce acceleration for homing move M569 P0.1 V100 ; reduce V to ensure stealthChop is enabled M913 X90 ; drop motor current to 90% M915 X S10 F0 H200 R0 ; Set the X axis sensitivity ; G91 ; relative positioning G1 H2 X0.5 F10000 ; power up motor G4 P200 ; wait 200ms M400 ; G1 H2 Z5 F1200 ; lift Z G1 H1 X-255 F2500 ; move quickly to X axis endstop and stop there (first pass) G1 X5 F1200 ; go back a few mm G1 H1 X-10 F2500 ; move slowly to X axis endstop once more (second pass) G1 X10 F1200 ; go back a few mm G1 H2 Z-5 F1200 ; lower Z M400 ; wait for current moves to finish ; M913 X100 ; return current to 100% M915 X S30 F0 H200 R0 ; low sensitivity to avoid stalls during operation M201 X800 ; acceleration back to normal M569 P0.1 V2000 ; restore default for V G90 ; absolute positioning