I need some help again.

I need some help again. I am using this gcode and my printer is skipping a line. After it homes X and Y it tries to home Z which is wrong. Its supposed to move the print head to the center of the bed and then home z. Can somebody tell me what ive done wrong.

; perimeters extrusion width = 0.40mm
; infill extrusion width = 0.67mm
; solid infill extrusion width = 0.67mm
; top infill extrusion width = 0.67mm
; support material extrusion width = 0.40mm

G21 ; set units to millimeters
M190 S40 ; wait for bed temperature to be reached
M104 S175 ; set temperature
G28 X200 Y2020 ;home X & Y
G1 X97.5 Y97.5 F5000 ;move nozzle to centre of bed
G28 Z0 ;home Z
G29 ;probe bed
G90; set absolute coordinates
G92 E0; reset extruder distance
G1 Z5 F300 ;move nozzle up 5mm for safe homing
G1 X0 Y0 Z0 F5000; move nozzle to home
M109 S175 ; wait for temperature to be reached
G90 ; use absolute coordinates
G92 E0
M82 ; use absolute distances for extrusion
M106 S255

In the first G28 you have Y2020 which looks wrong to me. Did you mean Y200?

Also, your G28 is incorrect. To home X and Y it should be G28 X Y and for Z it would be G28 Z. You don’t give values to X, Y and Z.

@Neil_Darlow While that’s true, G28 will simply ignore the coordinates after the axis label (X, Y or Z).

If your printer is somehow already set to relative coordinates, that might explain why it’s skipping that line. You could try putting the G90 before that line and you might as well use G0 (fast move) to move to the center of the bed.

Marlin has a setting for Z safe homing that will always move it to the center of the bed before homing Z, but I haven’t tried it.

Ok i removed the numbers in the G28 and no improvement.
I put the G90 before the G28 no improvement
I checked Marlin and i already had Z Safe active.
would it help if i posted the mechanical section of Marlin that i am using?

UPDATE** When i delete the g28 z and the g29 code the printer follows the g0 x97.5 y97.5

this works:

G21 ; set units to millimeters
G90; set absolute coordinates
G28 X Y ;home X & Y
G0 X97.5 Y97.5 ;move nozzle to centre of bed
G92 E0; reset extruder distance
G1 Z5 F300 ;move nozzle up 5mm for safe homing
G1 X0 Y0 Z0 F5000; move nozzle to home

this skips the 4th line and goes to the 5th

G21 ; set units to millimeters
G90; set absolute coordinates
G28 X Y ;home X & Y
G0 X97.5 Y97.5 ;move nozzle to centre of bed
G28 Z
G92 E0; reset extruder distance
G1 Z5 F300 ;move nozzle up 5mm for safe homing
G1 X0 Y0 Z0 F5000; move nozzle to home

I fixed it!!! Turns out you have to enable all endstops

what are you using for the FW, ie, marlin?? mobo, ie, Ramps? bed leveling, ie, servo switch or inductive?

i have a ramps1.4 running marlin 1.0.2(latest), tried bed leveling with inductive probe, but the Z axis just bounces up and down 10mm without goin to the bed…while X Y home perfectly…and when u tell it to do bed leveling (g29) it wont move… so im curious what and how you got it to work…

Ill have to check on the version but i am using marlin on ramps 1.4. I autobed level with a endstop switch on a servo.
G29 wont work if you dont home firectly after xy. Try manually in pronterface running G28 xy, G0 X (whatever the middle of your bed i.e. 97.5) Y (middle of your bed), tgen G29