re-naming tool change macros
-
We're working on adding tool changing to our printer and we're not liking the macro names tpreN, tfreeN, and tpostN. This is NOT a request for them to be renamed. What we're thinking is that we would add some redirection to those macros using M98 commands.
-
tfreeN would call a macro we'd name tool_N_park
-
tpreN would call a macro we'd name tool_N_unpark
-
tpostN would call a macro we'd name tool_N_after_unpark
These names would be more meaningful to us and would collect all the tool-change macros for a single tool next to each other in the sys directory.
My question is whether there is any behind-the-scenes stuff that happens in the firmware that we'd break with this strategy. The only thing I can think of is the automatic storing of the tool position coordinates in "slot 2" when a T<N> command is issued, I from my understand of how M98 works, this should not get broken.
My worry is that if the M98 command is the last statement in one of the tool change macros (tfreeN, for example), will the fw believe tfreeN is completed when the M98 is called, or when the M98 completes?
-
-
@mikeabuilder Not sure if this answers your questions but it might help. When I was using a multi material hot end, I used variables and meta commands to create "universal" tool change macros named "toolFree","toolPre", and "toolPost". Then every tpre(n) had the same one and only command M98 P "toolPre", every tfree(n) called "toolFree" etc.
It worked fine and nothing got broken.
-
My question is whether there is any behind-the-scenes stuff that happens in the firmware that we'd break with this strategy.
The macros tfree#, tpre# and tpost# are embedded in a number of steps RRF takes in response to a T# GCode. The macro names have been chosen by intent: they describe their role (or ”position”) in the tool change sequence. It is documented here: "Multiple tools and Tool change macros"
My worry is that if the M98 command is the last statement in one of the tool change macros (tfreeN, for example), will the fw believe tfreeN is completed when the M98 is called, or when the M98 completes?
You are free to call macros from within other macros, and once a macro is done, it returns control to its caller. If the calling macro has no further commands to execute, it returns control to its caller - which, in case of tfree#, tpre# and tpost#, is the already mentioned tool change sequence.
Studying the tool change sequence carefully, you don’t have to guess what the firmware ”believes”, you then know under what conditions the tool change macros (and whatever macros you call from within) are invoked.
-
Thanks for the feedback and the pointer to the doc page.
@deckingman - I like the idea of common docking and undocking macros, but at the present time, we're keeping all the commands in each macro to make it easier for us to design and debug.
@infiniteloop - The page you referred us to is a big help (I was using this: https://docs.duet3d.com/en/User_manual/Tuning/Macros and this: https://docs.duet3d.com/User_manual/Reference/Gcodes#t-select-tool and the G60 command documentation). I'm a big fan of not guessing about what the fw is doing, but sometimes we've found that not every step gets documented, so I thought I'd query the collected wisdom. (For example, the page you referred me to has clear steps identified, but omits the step where the fw saves the current tool position into "slot 2" before calling tfree. This is documented elsewhere, but no on this page.) Not complaining, just trying to be thorough.
-
Sometimes we've found that not every step gets documented …
… or, as you've confirmed, "elsewhere". In general, Duet is well documented, but as it is not just the firmware but a whole ecosystem which has to cover mechanical, electrical and UI topics as well, it requires a lot of reading (and, sometimes, deep digging). Finally, we got this forum - glad I could give a hint
-
@mikeabuilder I've updated the wiki page https://docs.duet3d.com/en/User_manual/Tuning/Tool_changing#tool-change-macros with a better description of the tool change macros, and the automatic save of position to slot 2.
Ian
-
Thanks doc!