One thing that leaps out at me is that you don't move away from the end stop, you move further towards it. You have this….....

G1 S1 X-280 F400 ; move quickly to X axis endstop and stop there (first pass)
G1 X-5 F600 ; go back a few mm
G1 S1 X-233 F400 ; move slowly to X axis endstop once more (second pass)

That second line should be
G1 X5 F600

That is to say, take out the minus sign.
HTH