This Macro behaviour is driving me (even more) insane

  • I'm experimenting with a purge bucket and to test it, I've written a little macro as follows:

    T0 ; select tool 0
    M109 S185; heat to 185
    G10 ; retract
    G90; absolute
    G1 X50 Y364 F9000; move quickly to rear and X=50
    G1 E30 F300; extrude 30mm at 5mm/sec
    G10; retract
    G1 X55 Y350 F1000; move forward and right
    G1 X60 Y364; move back and right
    G1 X180 Y180 F9000; move to centre
    M109 S0; turn off heater

    Which all works fine except that the Z axis always moves to absolute position of 5 mm. But there are no G1 Z moves in that macro!

    So, I can do "home all" which leaves Z at 5mm. Then if I do Z + 100 from DWC or enter G1 Z100 in the console so that the bed is either at 105 or 100 and then run the macro, that first G1 X50 Y364 F9000 moves Z to absolute 5mm as well as X and Y to the correct coordinates. The move happens really slowly because the Z axis limits the speed. No matter what I try, it has to move Z to 5mm while it does that G1 X50 Y364 F9000 move from within the macro. But I can move the bed to Z=100 then enter G1 X50 Y364 F9000 in the console and it moves as expected and Z remains where it is. Yet the same command in the macro is behaving as if a print was paused and there is a hidden "R" parameter for the Z axis somewhere.

    It's driving me nuts and I can't for the life of me figure out why it is behaving this way.

  • administrators


    • What are your M207 settings? Perhaps you have some Z lift configured.

    • Did you really mean to have 2 retract commands and only 1 unretract command?

    • Does tool 0 have the same Z offset as whatever tool was selected before?

    • Do you have anything in your tool change files?

    • What happens if you replace T0 by T0 P0 to suppress running the tool change files?

    • Try putting M400 both before and after the T0 command (although it shouldn't be needed)

    • Are you running firmware 1.20beta11 ?

  • Hi David,

    To be clear, if I move the bed to plus 105mm, then run the macro it will move the bed negative 100mm to the position Z=5 so it ain't likely to be Z lift or the like.

    M207 S5.0 R0 F4800 T3600 (pasted for config.g)

    Re retracts. For the purpose of what I'm testing, it's retract - move - unretract (not strictly necessary) - extrude - move back. If I put another unretract after the final move, it'll just ooze filament in the centre of the bed, which is not what I want to happen.

    Tool 0 has no offsets, neither do any other tools (it's a Diamond so all tools use the same nozzle).

    All tool change files are empty - one of the first things I checked.

    I'll try the T0 P0 and M400 suggestions.

    Yes it's 1.20beta11 (and DWC 1.19.3)

  • Update.

    Just tried replacing T0 with T0 P0 - no change in behaviour

    Tried putting M400 before and after T0 - no change in behaviour.

    It doesn't matter where I position the bed, whether it's at Z=20, 50, 100, or 500mm, it will always move to the absolute position Z=5 while doing the G1 X50 Y364 F9000 move.

    Everything related to T0 from config.g as follows;
    M563 P0 D0:1:2:3:4 H1 ; Define tool 0
    G10 P0 X0 Y0 ; Set tool 0 axis offsets
    G10 P0 R0 S0 ; Set initial tool 0 active and standby temperatures to 0C
    M568 P0 S1 ; Enable mixing for tool 0
    M567 P0 E1.00:0.00:0.00:0.00:0.00 ; Set mixing ratios for tool 0

    G31 is this:
    G31 P700 X0 Y0 Z-0.5

    Where the hell is that G1 Z5 (absolute) coming from? It has to be somehow carried over from homeall.g. That's the only thing which has a G1 Z5 move in it. End of homeall.g is this:
    G91 ;relative
    G1 Z5 F300
    G90 ; back to absolute
    M906 X1800 U1800 Y1800 V1800 Z1800 ; set motor currents back to defaults
    M104 S0; set hot end temp back to zero

    This makes no sense at all to me.

  • So I commented out all the lines in the file apart from G1 X50 Y364 F9000.
    Set the bed height to 105mm then ran the macro (with just this one line) and the bed stayed put.

    Then I uncommented the "T0" so the macro looks like this (just select T0 and then move):
    T0 ; select tool 0
    ;M109 S185; heat to 185
    ;G10 ; retract
    ;G90; absolute
    G1 X50 Y364 F9000; move quickly to rear at X=50

    Ran that and it worked fine - bed stayed put at 105 mm

    Then I uncommented the M109 so the macro looks like this (select T0, heat nozzle, then move):
    T0 ; select tool 0
    M109 S185; heat to 185
    ;G10 ; retract
    ;G90; absolute
    G1 X50 Y364 F9000; move quickly to rear at X=50

    Ran the macro and the bed moved up 100mm to Z=5

    So it's the M109 S185 (heat nozzle to 185 and wait) preceding the move that causes Z to go to absolute 5mm. How the hell can that be?

    Edit and Update - If I pre-heat the nozzle to 185 via DWC and comment out the M109s in the macro it works fine.

  • administrators

    Thanks for investigating that. M109 calls the tool change sequence, although in this case it shouldn't do anything because there is no tool change involved. But it's probably the tool change sequence that is causing the issue. I'll look into it.

    Meanwhile, try using M104 S185 followed by M116 instead of M109.

  • Thanks David. Good to know that I am in fact no more insane than normal 🙂

    Yes M104 followed by M116 works.

Log in to reply