Sculpfun S9 - Hard Limit issue

Hello All,
My 5.5 watt module lost power so I bought a new module / MB and Connection cables.
After I installed everything, the laser is not working how it should.
I connected the limit switch like:
RED (X): I connected the X cable
BLUE (Y): I connected the Y cable.

I have used the reset command.

Laser Setting
$0=10
$1=25
$2=0
$3=4
$4=0
$5=1
$6=0
$10=1
$11=0.010
$12=0.002
$13=0
$20=0
$21=1
$22=1
$23=7
$24=200.000
$25=3000.000
$26=250.000
$27=2.000
$30=1000.000
$31=0.000
$32=1
$100=80.000
$101=80.000
$102=250.000
$103=100.000
$104=100.000
$105=100.000
$110=6000.000
$111=6000.000
$112=1000.000
$113=1000.000
$114=1000.000
$115=1000.000
$120=1000.000
$121=1000.000
$122=1000.000
$123=200.000
$124=200.000
$125=200.000
$130=400.000
$131=410.000
$132=200.000
$133=300.000
$134=300.000
$135=300.000

When I try to home the gantry only moves to the left till it gives me error:

Hard limit triggered. Machine position is likely lost due to sudden and immediate halt.
Re-homing is highly recommended.

The console shows:

When I Switch the Limit cables.
RED (X): I connected the Y cable
BLUE (Y): I connected the X cable.

I can burn one project and after that the connection is lost.

Who can help me?

Use the question mark command (?) to check if the switches are recognized correctly. It’s explained here: Limit Switches - Diode Laser Wiki

It gives me:
<Alarm|MPos:0.000,0.000,0.000|FS:0,0|Pn:XY|WCO:0.000,0.000,0.000>

At this time, have the switches been pressed or not?

Shows that X and Y limit switches are recognized as activated. If you did not press them while you sent this command, you need to change $5=0 (if it was 1 before).

The module was in the homing position.
Now I get this error :(.

error:8

Grbl ‘$’ command cannot be used unless Grbl is IDLE. Ensures smooth operation during a job.

When do you get this error? Right from the beginning? That’s no issue, just click on Stop once.

When I wanted to move the gantry.

Then press the stop button and try again. The laser should be unlocked then.