... check the pin assignments, grounding and eventually connections of the endstops to +12V or such.
Measure the voltages when manually open/close the endstops against logic ground ... seems you have overvoltage-spikes that knock-out the logic circuits ...
Measure the voltages when manually open/close the endstops against logic ground ... seems you have overvoltage-spikes that knock-out the logic circuits ...