This is a relatively new problem as everything was working very well for many months. When homing, the endstops appear to do their job and stop everything but the machine hangs and has 1 command waiting. Any further commands don't go through. Found out that one endstop (rarely the same one) needs to be triggered by sticking something small in there and manually clicking it. Then it continues as normal and all waiting commands go through.
I can't check M119 for endstop status at that time because no commands go through. After I click the problem switch though I can check M119 and it will usually show 1 switch is not activated and should be or activated and should not be.
Basically, the switches are sending the correct signal but it seems its just a false trigger. Are these switches worn out? Is it signal noise? This machine hasn't really had THAT much use so shouldn't be worn out. And why would this problem manifest itself all of a sudden? Nearly every time it homes now.
Tried adding and removing debounce from the code but no effect.