# Printer goes beyond the bed when auto leveling

I am trying to add auto bed leveling to my Prusa i3. When I run G28 my printer hits the X and Y end stops properly, then it assumes X=25, Y=99 position on the bed and performs Z homing, after which it stays there. The problem is when I run G29 then it starts following the grid points from this position and tries to go out of bed.

My settings for the grid are:

#define LEFT_PROBE_BED_POSITION 10
#define RIGHT_PROBE_BED_POSITION 140
#define BACK_PROBE_BED_POSITION 140
#define FRONT_PROBE_BED_POSITION 20


And travel limits are set to this:

#define X_MAX_POS 150
#define X_MIN_POS 0
#define Y_MAX_POS 150
#define Y_MIN_POS 0
#define Z_MAX_POS 220
#define Z_MIN_POS 0


I guess this might be relevant too:

#ifdef Z_SAFE_HOMING

#define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2)
#define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2)

#endif


I don't know how your firmware load handles G29 ,but here's a guess, based on information at the reprap wiki . Try using FBLR to force the travel limits.