I have used Marlin for 10 years. I have edited the config file more times than I have kissed my wife.
I have a lot of experience, but I have no idea whats going on here.
The printer is a common configuration with a moving gantry for the X axis containing the hotend. On that gantry is also a servo activated Z-probe on an arm.
When I use Octoprint to move the Z-axis, down button moves down, up button moves up so the motor polarity is correct. I have also done this with G-codes to confirm operation.
The config file is set up with z homing direction -1 as normal with the define in place for seeking Z-Min.
THE PROBLEM is that homing causes the gantry to move UP instead of down towards the bed. It's even weirder than that. It moves up quite a bit and then the servo activates. I can usually get it to think it's done by pressing the Z_MIN switch a few times at that point.
It has to be a configuration problem, right? Here are some selected entries from the config file - the ones I am aware of that come into play.
#define USE_ZMIN_PLUG
#define Z_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING true // Set to true to invert the logic of the probe.
#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
#define USE_PROBE_FOR_Z_HOMING
#define Z_PROBE_SERVO_NR 0 // Defaults to SERVO 0 connector.
#define Z_SERVO_ANGLES { 27, 115 } // Z Servo Deploy and Stow angles
#define INVERT_Z_DIR false
#define Z_HOME_DIR -1
#define MIN_SOFTWARE_ENDSTOPS
#if ENABLED(MIN_SOFTWARE_ENDSTOPS)
#define MIN_SOFTWARE_ENDSTOP_X
#define MIN_SOFTWARE_ENDSTOP_Y
// #define MIN_SOFTWARE_ENDSTOP_Z
#define AUTO_BED_LEVELING_LINEAR
#define GRID_MAX_POINTS_X 3
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
#define VALIDATE_HOMING_ENDSTOPS
#define NUM_SERVOS 1 // Servo index starts with 0 for M280 command
If you have any personal experience with anything that looks like this, please let me know if you think I am doing anything wrong in config. If you do not have any specific wisdom, please do not respond (unless you are Mark).
It seems like a weird problem, but I know that I am doing something wrong. It works on my other machine, but that one runs Marlin 1.0 and I had to hack the bed leveling code into it manually back when it was new. Marlin 2 has way more configuration parameters and features which I am finding a little cryptic.
The endstop (probe) is a NO switch (to ground) with a 4.7k pullup.
I just know I'm going to feel stupid...
Hi everyone, interesting troubleshooting thread! It’s impressive how much clarity comes from checking endstop logic, servo activation, and config direction when something seems off—like your Z‑axis homing moving in the wrong direction.
It actually reminds me a lot of what we deal with in logistics when sending air cargo to Pakistan: one small misconfiguration—whether it’s incorrect documents, wrong customs codes, or mislabelled addresses—can send a shipment off in the wrong “direction,” causing delays or returns. Just like in 3D printing where the wrong polarity or inverted direction (like INVERT_Z_DIR or endstop logic) can reverse movement, a simple paperwork error in air freight can reverse the flow of a package.