You switched M574 from S1 to S2. S2 is for using a z probe. Do you have active high switched, or active low switches?
https://duet3d.dozuki.com/Wiki/GCode#Section_M574_Set_endstop_configuration
Here is a safe way to test your endstops before you try and move any axis.
https://duet3d.dozuki.com/Wiki/Connecting_endstop_switches
https://duet3d.dozuki.com/Wiki/ConfiguringRepRapFirmwareCartesianPrinter#Section_Homing_files
When you click the endstop switch with your finger does the light on the Duet go off or turn on? In the DWC machine properties tab does the endstop show as triggered?