I often see confusion by people in IRC about how to disable and enable endstops so that accidentally sending a home command (G28) doesn’t cause their printer to crash an axis past it’s physical range. G28 is a command that moves an axis until it triggers an endstop switch placed at the end of the axis. When the switch triggers, the position is set to either MIN or MAX for the axis, depending on which direction homing is set to use. Homing to the MIN endstop is by far the most common method, so G28 moves the axis in the negative direction looking for an endstop and stops when it triggers it and sets the current position to zero. If you don’t have an endstop installed, it will never trigger it and try to go farther than it can, and various bad things can happen, what I call “crashing” the axis. To avoid this, if you do not have hardware endstops for the G28 command to use, you can disable endstops completely in the firmware.

I use RAMPS electronics, so my MOTHERBOARD definition in Configuration.h is 33. The endstops are not actually disabled from Configuration.h, they are defined to the correct pins for your electronics type in the pins.h file. To find them, you will need to find the section in your pins.h for the set of pin definitions for the electronics you use. For RAMPS board type 33, my pins.h looks like this:


#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define X_MIN_PIN -1 //3
#define X_MAX_PIN -1 //2

#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define Y_MIN_PIN -1 //14
#define Y_MAX_PIN -1 //15

#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN -1 //19

If you are not using RAMPS you just need to find these same lines under the section for your board. Notice these lines in mine:

#define X_MIN_PIN -1 //3
#define X_MAX_PIN -1 //2

#define X_MIN_PIN -1 //3
#define X_MAX_PIN -1 //2

#define Z_MIN_PIN 18
#define Z_MAX_PIN -1 //19

See how each one except for Z_MIN_PIN is set to -1? This means that endstop is disabled. Everything on a line after a // is a comment, and shows the original value of the pin so I don’t have to look it up to enable it. For extra clarity, here’s how the Z minimum endstop looks when enabled:

#define Z_MIN_PIN 18

and here’s how it looks when disabled:

#define Z_MIN_PIN -1 //18

I don’t use MAX endstops, those are endstops placed at the maximum ends of an axis. They can be used for homing but it’s a rare choice to do so. Since the home coordinates by convention are 0,0,0, it’s common to only use endstops at the minimum end of an axis. It’s convenient also, since it’s most common to orient printing from 0,0,0 and by using endstops to home to 0,0,0 the nozzle is already where it needs to be to start printing. The firmware can use “software” endstops to keep track of the maximum end, by knowing it’s location relative to 0.

If you do disable endstops, it can also be handy to turn off minimum software endstops. If you have software endstops enabled, the axis will not move to a coordinate that it thinks is less than zero, so if it is wrong about it’s actual location it’s possible to crash an axis past it’s travel range. The lines that endable/disable software endstops are in Configuration.h:

#define min_software_endstops true
#define max_software_endstops false

To be able to move an axis lower than zero, you can set:

#define min_software_endstops false

There are many different types of hardware endstops, but there are only two ways for the switch logic to work, either Normally Open (NO) or Normally Closed (NC). Normally open means the switch closes the circuit when triggered, and in Marlin this seems to be the default in Configuration.h. I prefer to use NC switches that open the circuit when triggered, so I need to invert the logic in Configuration.h for my NC-wired microswitch endstops. The default lines for the endstop logic are:

const bool X_ENDSTOPS_INVERTING = true;
const bool Y_ENDSTOPS_INVERTING = true;
const bool Z_ENDSTOPS_INVERTING = true;

So for my Z endstop that is wired with a NC switch, I would invert the logic:

const bool Z_ENDSTOPS_INVERTING = false;

To sum up, you can disable your endstops by finding where their pins are defined in pins.h for your electronics and commenting out the existing values so you can easily restore them later, and setting the pin for each endstop you wish to disable to -1. In my example at the top I have all my endstops disabled except for the minimum Z endstop because the only one I had hooked up at the time was Z. It’s much more common to have either all three MIN endstops hooked up or none at all. It’s very rare to use hardware MAX endstops or all six endstops, using just the three MIN is the most common and convenient arrangement.