in your laptops power settings it can turn off the usb ports if they are not in use, try to turn that off.
i would suggest to take a long hard look at how the printer contacts the endstop switches, what part of the printer makes contact? does the whole switch move? does it need to be more firmly affixed to the frame? can you move the switch so that the printer makes contact with the far end of the lever? (this will mean it will take less force to actuate the switch)
have you taken a multimeter to the switch and checked that it fully opens when the switch closes?
and just for clarity when you make a change to the firmware you have to re-upload it to the arduino before it takes effect.
i would suggest to take a long hard look at how the printer contacts the endstop switches, what part of the printer makes contact? does the whole switch move? does it need to be more firmly affixed to the frame? can you move the switch so that the printer makes contact with the far end of the lever? (this will mean it will take less force to actuate the switch)
have you taken a multimeter to the switch and checked that it fully opens when the switch closes?
and just for clarity when you make a change to the firmware you have to re-upload it to the arduino before it takes effect.