Need help with homing XYUV and conditional gcode
-
This post is deleted! -
@T3P3Tony said in Need help with homing XYUV and conditional gcode:
Hi Ian
suggestion from @chrishamm
if sensors.endstops[x].triggered || sensors.endstops[y].triggered abort "Endstops already triggered at the beginning of the homing move, aborting"
would need expanding for all the endstops you wanted to check
Hi Tony,
Thanks for that. Could you confirm what I suspect the "abort" does? I assume that if the above command (with X and U end stops) was at the start of my home all macro, it would abort that home all macro yes? If I had a similar command later in the macro file but with Y and V as the end stops, I assume that XU will home but then the rest of the macro would terminate if either a Y or V endstop is already triggered yes?Edit. Scratch that - just found a description of the "abort" command.
-
I've tried the above suggestion - i.e .......................
if sensors.endstops[x].triggered
.............and I get an error message:
Error: in file macro line 18 column 21 : meta command : unknown value 'x'.
I tried both upper and lower case "x".
-
@deckingman
x
andy
must be replaced with the indices of your endstop (first item is0
, second1
etc). You can sendM409 K"sensors.endstops"
to view the current list and states. -
@chrishamm said in Need help with homing XYUV and conditional gcode:
@deckingman
x
andy
must be replaced with the indices of your endstop (first item is0
, second1
etc). You can sendM409 K"sensors.endstops"
to view the current list and states.Ahh - thanks for that.
-
So I just sent M409 K "sensors.endstops" and gotError M409 : expected string expression.Scratch that. I discovered that one must not have a space after the K
-
This M409 isn't very helpful. It just lists the status (true or false) for all the end stops but it doesn't say which end stop is associated with which axis.
-
Other than using DWC to show the end stops, then triggering each one by hand and looking to see which one changes state, is there any other way to know which index value is assigned to which axis?
It isn't the order that they are created in config.g because I created XYUVAB and finally Z in that order but Z is index number 2. I haven't been able to find anything in the documentation but it might be buried in there somewhere.
-
Well that was fun. For anyone else stumbling across this thread, the only way I could discover which end stop index value refers to which axis was to use DWC to display the end stops under machine properties. Here the end stops are listed by index value rather than by axis letter, along with their trigger status. So I had to trigger each one in turn and revert to pen and paper to record which index is assigned to which axis.
It would be helpful if someone who knows how end stop incises are assigned to axes could add that to the documentation somewhere.
I ended up using separate statement for each end stop so that I got a meaningful message about which end stop to check. i.e.......
;****check if an enstop is alreday triggered becuase it might be a wire has fallen off ; X=0,Y=1,Z=2,U=3,V=4,A=5,B=6 if sensors.endstops[1].triggered abort "Y endstop already triggered at the beginning of the homing move - aborting" if sensors.endstops[4].triggered abort "V endstop already triggered at the beginning of the homing move - aborting"
-
@deckingman said in Need help with homing XYUV and conditional gcode:
EDIT. Thinking about it a bit more, I guess an elegant solution would be to have a macro which checked the status of all end steps, which could be called at the start of any homing macro, but I'm open to suggestions.
You can iterate over all endstops (or other arrays) by using # to give you the number available
while iterations < #sensors.endstops if sensors.endstops[iterations].triggered echo "Endstop " ^ iterations " is triggered" abort
I had thought maybe this could be expanded to try to move away from any active endstop which would effectively test if it was broken (i.e. if it's still active after a 6mm move it's broken), but I can't see an easy way in the object model to determine if the endstop is at min/max or whether it's N/O or N/C.
Nor does it seem possible to determine the axis it is associated with other than to assume the endstop number would align with the axes number.
But if you had two endstops on an axes that'd fail.