@saadiqj I mean that where you use G1 S1 Z-370 to move the bed use G30 to call for a probe instead.

https://duet3d.dozuki.com/Wiki/Gcode#Section_G30_Single_Z_Probe

Here is my HomeAll.g for comparison.

; homeall.g ; called to home all axes ; ; BLTouch prep so we don't catch the probe pin on the edge of the bed ; M280 P3 S160 I1 ; Alarm Release and Push-Pin UP just in case it's in alarm and deployed M402 ; Retract probe just in case it's down ; Home XY for Z homing ; G91 ; relative positioning G1 Z5 F200 S2 ; Lower bed 5mm to ensure it is below the switch trigger height M913 X50 Y50 ; set X Y motors to 50% of their normal current for homing G1 S1 X-375 Y305 F4000 ; course home X or Y G1 S1 X-375 F4000 ; course home X G1 S1 Y305 F4000 ; course home Y G1 X2 Y-2 F1000 ; move away from the endstops G1 S1 X-10 F200 ; fine home X G1 S1 Y10 F200 ; fine home Y M913 X100 Y100 ; set X Y motors to 100% of their normal current ; Z homing section follows ; G90 ; absolute positioning G1 X190 Y90 F4000 ; Move x and Y axis over to bed center so probe is on top of bed ; Set lower speeds for homing M566 Z5 ; Set maximum instantaneous speed changes (mm/min) (Jerk) M203 Z350 ; Set maximum speeds (mm/min) M201 Z100 ; Set maximum accelerations (mm/s^2) ; Probe the bed ; M558 A1 F350 ; Set single probing at faster feed rate G30 ; Do a single probe to home our Z axis M558 A10 F100 ; Set tripple probing at slower feed rate G30 ; Probe again to get a more accurate position ; Set normal speeds again M566 Z60 ; Set maximum instantaneous speed changes (mm/min) (Jerk) M203 Z600 ; Set maximum speeds (mm/min) M201 Z600 ; Set maximum accelerations (mm/s^2) ; Move X and Y back Home ; G1 X0 Y270