Tool (un)loading checks AFTER tfree#.g / tpre#.g
-
Hey,
I have a toolchanger on my Duet CNC (single spindle, pneumatic clamp for tools).
Toolchanging works as intended. Recently I included a magnetic sensor which checks for the tool in the spindle.
I would like the tfree#.g and tpre#.g to check, if the (un)loading was successful.
My approach is:... if sensors.gpIn[4].value = 0 echo "loading tool failed!" T-1 P0 echo >"persistence/last_tool.g" "" abort "loading tool failed!" else echo "loading tool successful!" echo >"persistence/last_tool.g" "T"^{param.S}^" P0" G100 P{param.S}
(G100 is a macro to Z0 the tip of the tool with a micro switch, param.S is tool index)
Problem:T-1 P0
won't do the trick since RepRapFirmware will mark the tool as "selected" AFTER the tpre#.g (in this case) runs.
Is there a way to tell RRF that loading was unsuccessful?Thanks,
phil -
@punktphil P0 parameter will skip the toolchange macros. Soes it work if you leave that out?
-
@oliof the code i posted is in one of the tool change macros. Calling another macro (T# without the P0) won't help me. In fact, T-1 P0 unselects the current tool without running any macros. Which is what i want, but the tool gets reselected after my code by RRF.
-
@punktphil got you now. I would have expected
abort
to do the trick as well. Maybe try M99 instead.