Disable Z homing

Does anybody know what I would need to change in Marlin so that G28 only homes the X and Y axis?

I’m using dual endstops on the X and Y axis, and no endstop on the Z axis. Right now, G28 first lifts Z by 10mm, homes X and Y, and then tries to home Z, but since there is no endstop it would push the spindle into the wasteboard and probably rip itself apart.

I know that I can use G28 X Y, but I also know that I will at some point accidentaly hit the “home all” button, and I’d like to prevent the machine destroing itself.

You can add a custom menu item pretty easily in config-adv.h

Bad idea. If you don’t home the Z axis as well then it won’t make negative movements aka down during a print or cut. Other suggestions to follow.


It sounds like you have this set to true. Better to set it to false in the configuration_adv.h. Z_MIN_ENDSTOP_INVERTING. If you use false on the Z axis you don’t need to have a switch attached and the machine will think it is home where ever it is when it is homing. It will not smash down into your spoil board. It will move up a little twice when it is homing Z. If you don’t want that then you will want to make these changes as well.

#define Z_HOME_BUMP_MM 0 This setting is how far it will bounce back after it first thinks it tripped the home switch. Since I don’t use a homing switch on my Z axis I don’t want it to move at all. So no bounce for me.

There was another setting somewhere that that defined how high it moved Z before it started homing X and Y. I don’t remember the name but I either disabled that or set it to 0.

The setting Ryan is referring to that turns on LCD menu options to home x y and z individuality is INDIVIDUAL_AXIS_HOMING_MENU. I also turned this on but like I said at the beginning you will want to home Z before you start a job.

1 Like

Z should always be able to do negatives, it is set differently in the firmware. XY are not allowed to go negative.

You can set individual axis homing , but you can also program your own button very easily in the adv file just by adding G28 X Y.

1 Like

That’s cool did not know that. Most of my experience has been in repetier firmware. Marlin is better.

Thanks for the suggestions, I forgot to mention that I don’t have an LCD…

But I will try changing the Z_MIN_ENDSTOP_INVERTING setting when I get home :slight_smile:

I guess another possibility would be to just use a jumper on the Z min endstop pins, and if I would ever need the Z probe I could just remove the jumper and plug in the probe…

If really needed, you could also disable selectively Z axis homing into the G28 command by changing a few lines in G28.cpp (but not absolutely trivial)

1 Like

I think I found it :slight_smile:

Commenting out those 2 blocks would disable all Z homing functions, but would leave Z probing with G29 working. I can test it as soon as I get home from work :slight_smile:

In /Marlin/src/gcode/calibrate/G28.cpp

Line 256:

#if Z_HOME_DIR > 0 // If homing away from BED do Z first

if (home_all || homeZ) homeaxis(Z_AXIS);


const float z_homing_height = (
!TEST(axis_known_position, Z_AXIS) ? 0 :
(parser.seenval(‘R’) ? parser.value_linear_units() : Z_HOMING_HEIGHT)

if (z_homing_height && (home_all || homeX || homeY)) {
// Raise Z before homing any other axes and z is not already high enough (never lower z)
destination[Z_AXIS] = z_homing_height;
if (destination[Z_AXIS] > current_position[Z_AXIS]) {

SERIAL_ECHOLNPAIR("Raise Z (before homing) to ", destination[Z_AXIS]);



Line 337:

// Home Z last if homing towards the bed #if Z_HOME_DIR < 0 if (home_all || homeZ) { #if ENABLED(Z_SAFE_HOMING) home_z_safely(); #else homeaxis(Z_AXIS); #endif


} // home_all || homeZ
#endif // Z_HOME_DIR < 0

It works :slight_smile:

After commenting out the two blocks of code mentioned above, G28 now just homes the X axis, then the Y axis.

Z is not lifted in the begining and it’s not trying to run into the spoilboard at the end.

I couldn’t test G29 yet, I have to first make some sort of Z probe…

Same wires as an end stop, but a thin sheet of metal on one wire, and an alligator clip on the other. Clip the clip on your end mill and hold the sheetmetal on your surface.

Where is the G28.cpp file?

Ah, sorry, I checked pn the bugfix-2.0.x files. If you’re on a 1.x, it’ll probably be in the gcode.cpp file (G28() function) but I don’t have that version here…

Oh, yeah I think I’m using version 2 of marlin too, I don’t know where you can find that code in 1.x or how you have to modify it…