# Define coordinates for Z homing

I have a printer with the following dimensions: L300 x W300 x H400. After flashing Marlin software, the extruder keeps homing at X77 Y50 instead of X150 Y150 that is the center of the printing area for me. Where can I find the appropriate line in config file in order to edit it with preferred coordinates. Unfortunately I can only find info on how to change offset of origin point. In my case origin point is correcty set.

• Does this answer your question? How to center my prints on the build platform? (Re-calibrate homing offset) – Trish Nov 5 '20 at 22:41

If you enabled Z_SAFE_HOMING, then automatically the printer homes Z at the middle of the build plate, if the bed size dimensions are correctly defined (in your case X_BED_SIZE and X_BED_SIZE should be defined as 300).

In Configuration.h you can find:

#define Z_SAFE_HOMING

#if ENABLED(Z_SAFE_HOMING)
#define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE) / 2)    // X point for Z homing when homing all axes (G28).
#define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2)    // Y point for Z homing when homing all axes (G28).
#endif


If Z_SAFE_HOMING was enabled, and the bed properly dimensioned, it could be that the steps/mm are incorrectly defined.

Note that if a probe is used, the offset of the probe to the nozzle center is taken into account, this implies that the probe is moved to the center, not the nozzle. The code responsible for this is found in G28.cpp:

/**
* Move the Z probe (or just the nozzle) to the safe homing point
* (Z is already at the right height)
*/
destination.set(safe_homing_xy, current_position.z);

TERN_(HOMING_Z_WITH_PROBE, destination -= probe.offset_xy);


I.e. the ternary operation (TERN_) determines the addition of the probe offset.

• It worked perfectly. The only comment is that it centers the BL TOUCH probe instead of the extruder nozzle. Do you recommend to subtract the distance between the probe and the extruder nozzle and modify the Z_SAFE_HOMING_X_POINT value accordingly or there is a smarter way to input that distance in an initialization stage of the code? – STATHIS May 8 '20 at 21:01
• @STATHIS You should probe the middle of the bed, with the probe, not the nozzle! This way the probe determines the height of the bed for the nozzle. But yes you can alter the values if you want, but that wouldn't be necessary. Happy printing! :-) – 0scar May 9 '20 at 6:07