Is there a way to know what axis a limit switch? When sending gcode over serial if i hit a limit switch, I want to know what axis (or rather which limit switch) I hit. The box has pins in the back saying x-axis, y-axis, z-axis and Im curious if I have a way of interacting with grbl. I thought maybe I could send a '?' command over and get info about the positioning of each axis and try to figure out which one hit that way but i think while it is in its alarm state I cant send '?' Curious if there is any info being sent to the box that I can catch about what limit switch was hit. In context I am sending gcode through a terminal and not using the control interface that would tell me what position it believes each axis.
Grbl does a "port based interrupt" for speed (polling each pin in turn would cause issues with stepgen and also reaction speed of the limits), and as such only knows "one of the limits" got hit. Grbl doesn't even know, Grbl thus cannot tell the host application either: Refer gnea/grbl
Thanks Peter. I was afraid of such news. I appreciate your response especially since I now see this is a grbl question rather than a black box one. so is it the case that ports (er..pins...forgive me) labeled x-limit y-limit etc are just for fun / user organization?
Pretty much yes. Port = group of pins. Reading a port in parallel, bitmasking, etc is a lot faster than DigitalRead the Arduino world uses. Even looking at "i know i sent an X+ move so it must be the X max switch" would not always be true because you could get an EMi related false trigger on another switch instead