That does look correct. What did your experiments with M119 produce? If results were inverted to what was expected, you’ll need to adjust a different setting to invert the logic. Can’t recall off the top of my head where that is as on my phone. Maybe in the endstops section.