It will take some time as I have some other obligations.
As to reading the end-stop switches, that is already supported.
They are just normal inputs thus a 'READ input' command will give you that information.
You can try it with the GUI by first switching to 'board' mode. On the LHS is a Read button.