# X Axis Auto Level

**URL:** <https://forum.lulzbot.com/t/x-axis-auto-level/26257>\
**Category:** Software\
**Created:** [December 21, 2023, 5:25pm UTC](https://forum.lulzbot.com/t/x-axis-auto-level/26257 "2023-12-21T17:25:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lrd](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@lrd](https://forum.lulzbot.com/u/lrd)\
**Post date:** [December 21, 2023, 5:25pm UTC](https://forum.lulzbot.com/t/x-axis-auto-level/26257/1 "2023-12-21T17:25:45Z")

</div>

When Workhorse first starts it auto levels the X Axis. Anyone know the gcode to accomplish this?  
I’ve loaded firmware for BLTouch and it doesn’t do the auto level at start.

---

<div class="post-metadata">

**Author:** ![zenotek](https://avatars.discourse-cdn.com/v4/letter/z/ad7895/32.png) [@zenotek](https://forum.lulzbot.com/u/zenotek)\
**Post date:** [December 22, 2023, 2:23am UTC](https://forum.lulzbot.com/t/x-axis-auto-level/26257/2 "2023-12-22T02:23:21Z")

</div>

Normally, G34 would do this. But looks like Lulzbot didn’t use that feature and instead did it this way:

#if ANY(TAZPro,TAZProXT,Workhorse)  
#define X\_LEVEL\_SEQUENCE  
#endif  
#if defined (X\_LEVEL\_SEQUENCE)  
#define LEVELING\_COMMANDS “G28 Z\nM18 Z\nG4 P300\nG28 Z” //Homing to the top, disabling the Z motors for 300ms and then rehoming Z  
#else  
#define LEVELING\_COMMANDS “G28 \nG34 \nG28”  
#endif

Try a G34 and see if it works, otherwise, type the commands:

G28 Z  
M18 Z  
G4 P300  
G28 Z

I have my own custom Drunken Octopus firmware and a BL Touch and in configuration\_adh.h I use this:

/\*\*

- Mechanical Gantry Calibration
- Modern replacement for the Průša TMC\_Z\_CALIBRATION.
- Adds capability to work with any adjustable current drivers.
- Implemented as G34 because M915 is deprecated.
- @section calibrate  
\*/  
#define MECHANICAL\_GANTRY\_CALIBRATION  
#if ENABLED(MECHANICAL\_GANTRY\_CALIBRATION)  
#define GANTRY\_CALIBRATION\_CURRENT 340 // Default calibration current in ma  
#define GANTRY\_CALIBRATION\_EXTRA\_HEIGHT 2 // Extra distance in mm past Z\_###\_POS to move  
#define GANTRY\_CALIBRATION\_FEEDRATE 100 // Feedrate for correction move  
//#define GANTRY\_CALIBRATION\_TO\_MIN // Enable to calibrate Z in the MIN direction

//#define GANTRY\_CALIBRATION\_SAFE\_POSITION XY\_CENTER // Safe position for nozzle  
//#define GANTRY\_CALIBRATION\_XY\_PARK\_FEEDRATE 3000 // XY Park Feedrate - MMM  
//#define GANTRY\_CALIBRATION\_COMMANDS\_PRE “”  
#define GANTRY\_CALIBRATION\_COMMANDS\_POST “G28” // G28 highly recommended to ensure an accurate position  
#endif

This requires you set Z\_MAX\_POS to a very specific value based on how far the distance is between the probe and the top of the gantry since homing is now happening at the bottom instead of the top. So you will have to edit the firmware a few times to get G34 to work right. And pro tip, it really doesn’t work that well. I plan to set up independent z axes eventually by using the E1 stepper driver.

---

<div class="post-metadata">

**Author:** ![lrd](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@lrd](https://forum.lulzbot.com/u/lrd)\
**Post date:** [December 22, 2023, 3:11am UTC](https://forum.lulzbot.com/t/x-axis-auto-level/26257/3 "2023-12-22T03:11:24Z")

</div>

Thanks you!  
I need to recompile the firmware tomorrow anyway so I’ll try that first.

---

<div class="post-metadata">

**Author:** ![American\_3D\_Printing](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.lulzbot.com/american_3d_printing/32/19_2.png) [@American\_3D\_Printing](https://forum.lulzbot.com/u/American_3D_Printing)\
**Post date:** [December 26, 2023, 10:51pm UTC](https://forum.lulzbot.com/t/x-axis-auto-level/26257/4 "2023-12-26T22:51:50Z")

</div>

G29 is the command to auto level, both for washer touching and also for BL touch.

---

<div class="post-metadata">

**Author:** ![lrd](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@lrd](https://forum.lulzbot.com/u/lrd)\
**Post date:** [December 27, 2023, 3:20pm UTC](https://forum.lulzbot.com/t/x-axis-auto-level/26257/5 "2023-12-27T15:20:11Z")

</div>

Thanks, but I’m actually inquiring about the leveling of the X gantry. The Workhorse used to belts instead of lead screws for Z travel. They are more apt to become out of square and need to be  
“re-zeroed” more often.
