Where to insert Macro / timing

  • I am stuck and could use a pointer:

    Latest RRF, using Cura as the slicer, dual nozzle configuration

    The scenario: Nozzle sits over a drool tray. It has been selected and is in the process of warming up. When it has reached operating temperature, it would go at whatever the appropriate speed is to where it needs to print. I would like to somehow tell the printer that the nozzle should pass over the wiping station at slow speed before reverting to regular speed to carry on with the print.

    Another way of looking at it:

    Nozzle 1 does it's thing and is printing
    Nozzle 1 has finished printing
    Nozzle 1 is deselected
    Gantry is moved to the drooling position (works)
    Nozzle 2 is directed to heat up, Gantry waits over drool position until operating temperature is reached

    Code that needs to go here: Move gantry slowly left by 50 mm in order to wipe nozzle

    Gantry moves full speed to where it continues printing.

    I can not insert the code as a start code for nozzle 2 as it would execute before nozzle 2 is up to temperature
    Tfree/Tpost/Tpre all seem to be inappropriate times to insert the code
    I could of course edit the Gcode file and insert the code in the right place but the point of this exercise is to not have to manually edit the gcode.

    I am pretty certain I am overlooking something simple but maybe I can't see the tree for the forest ....

    Suggestion ?

  • bumpbump

  • @jens55 This is how I do it with my single nozzle, multi input, hot end. You might be able to adapt to your situation.
    I have a macro called "NozzleWipe" which takes care of the movement. I also have another macro called "PrePrint" which gets called from the slicer start code. And a third macro called "InPrintPurge" which gets called on tool change.
    PrePrint takes care of everything that needs to happen before the first print move. The last things it does is move the nozzle to the purge area, wait for the hot end to finish heating, then call "NozzleWipe.
    InPrintPurge happens at tool change. This is where you might need to get creative. I've never used the tool change macros. Instead I use a Python Script to post process the gcode file and insert "InPrintPurge" after every "T" command. But I guess you could use one of the tool change macros instead. InPrintPurge does as it's name implies and purges into a "bucket", then in calls NozzleWipe, then resumes printing.
    NozzleWipe also gets called by my home all because I use the hot nozzle as a Z probe.

  • Thanks for replying. If even YOU have to improvise then I think I am screwed 😞
    Too bad that there isn't a hook of some sort to insert code after the nozzle has reached operating temperature.
    I am having a rough time explaining my need for the timing but let me try:
    The printer is happily printing along on nozzle zero and a tool change is called. The tool change causes the nozzle to go to the purge bucket (and also the wiper). The nozzle now sits there waiting for both nozzles to reach the commanded temperature so an M109 or it's equivalent was issued. We have run all the macro's that one can run at tool change time. I could have run the nozzle wipe before the M109 but it would defeat the purpose because while the temperatures of the two nozzles go to their respective values, stuff drools out of the nozzles. I need to wipe the stuff off after temperatures have finalized.
    Now as it turns out, wiping seems to be much more effective if done at a crawl so I can't just let the code execute a return to the print position after the nozzles have reached temperature. I need to do a slow move past the wiper and only then can the printhead go to carry on. I can't just do a slow return to the print position because it would take several seconds and new crap would be hanging off the nozzles. It has to be a slow movement for 50 mm and then a fast movement back to the previous print position.

    The only way I can see to fake the system is if I code my own temperature changes prior to the gcode calling for the change. This could be done as a tool change macro and could do a slow wipe after the temperatures are reached. Control then passes back to the main program and it's M109 command which executes right away because the nozzles are already at operating temperature.
    It seems really confusing and my brain hurts just thinking about it.
    I have no idea if this would work ....
    Trivial and extremely annoying would be to hand insert (don't know python well enough) a single gcode line right after the M109.

    I will need to contemplate this some more ....
    Tanks for your input, it gives me something to think about.

  • @jens55 I think you are over thinking this. The only reason I "improvise" is that I've never looked at the tool change macros, and I write little Python scripts to do other things, so it was easy enough for me to write a post process tool change script. But I'm reasonably confident that one of the tool change macros could be used instead - it's just that I've never looked into it..

    As you say, on tool change there is an M109 or equivalent - hopefully just an M116. So all you need do is insert the call to the nozzle wipe macro after than command. i.e. modify the tool change macro so that the nozzle wipe macro is the last thing that happens after the hot end reaches it's temperature.

    It's no different to what happens in my Pre-Print Macro which ends thus:

    M291 P"Waiting for heaters to reach active temperatures" R"Pre-Print Macro" S1 T10

    M116 ; wait for all temps including hot end

    M291 P"Wiping nozzle" R"Pre-Print PLA" S1 T5
    M98 P"0:/macros/Nozzle wipe"

  • For completeness sake, this is my NozzleWipe Macro

    ; ****Printer must be homed and nozzle heated

    G90; set to absolute coordinates

    G1 X50 Y364 F12000; move quickly to rear left
    G1 X80 Y352 F900; slowly right 30, forward 12
    G1 X110 Y364; slowly right another 30 and back 12
    G1 X140 Y352; slowly right another 30 and forward 12
    G1 X170 Y364; back and right

  • @deckingman, I have things working but I fully expect it to bite me in the ass sooner or later. It is not a clean solution as far as I am concerned.
    I put in an M116 in the start g code for the extruders ..... seems simple enough.
    Whenever there is a change in extruder, when the new extruder is selected that is followed by M116 followed by a slow wipe. Cura puts an M109 right after that code but since the appropriate temperature for the new extruder was set while the old extruder was still running (in an attempt to lower wait time), the M116 kludge works.
    It only works because of the pre-warming and sooner or later I expect a situation where there is no pre-warming and I will likely do some major head scratching at that time 🙂

    Thanks for your help!

  • @jens55 Yes, you could end up with the situation where the slicer and the firmware interact but don't necessarily play nice with each other. I try and use just the firmware/macros and turn off or disable as many of the slicer "features" as possible. I know that other people take a different approach and use the slicer to do as much as possible - even overriding the firmware configuration settings. I guess there isn't a right or wrong approach but I think a mix and match approach of both macros and slicer settings could lead to future confusion and problems.

    Try and make notes of what you've done and why, so that you can refer back to them in 6 months time if you run into a problems.

  • @deckingman said in Where to insert Macro / timing:

    Try and make notes of what you've done and why, so that you can refer back to them in 6 months time if you run into a problems.

    Yes, I will have to ....LOL

  • @jens55 said in Where to insert Macro / timing:

    @deckingman said in Where to insert Macro / timing:

    Try and make notes of what you've done and why, so that you can refer back to them in 6 months time if you run into a problems.

    Yes, I will have to ....LOL

    ............or start a blog to document everything. ☺

    I didn't think of it when I first started my own blog but it's surprising how often I find myself referring back to it when I'm trying to remember how or why I did something a couple of years ago. But then, that could just be my age ☺ ...........

  • Age is definitively an issue with me too .... and while I don't mind owning that I screwed up in a post, I think that detailing my screw-ups in a blog would be a bit much 🙂

  • Moderator

    Sometimes I wonder if my wife has a blog detailing my screw ups because she never seems to forget. 🤔

Log in to reply