@execute commands executed before gcode completes

I've added an '@execute' command at the very end of the 'end gcode' section of the printer settings in Slic3r.  However, the gcode in this section doesn't finish executing before the @execute command executes.  I've got gcode to home x & y and lift z 10 mm before disabling steppers and turning off the bed and extruder.  What happens is that as soon as the print is finished the @execute and @push message executes before the end gcode.  My @execute script powers off the printer, which leaves the print head melting into the last position of the print instead of lifting the Z and homing X & Y beforehand.  I've tried adding an M400 before the @ commands and a G4 S30, but always the @commands are processed first.
What am I doing wrong?


  • @execute gets executed once the previous command is send to printer. But printers cache moves and input queue can also store several commands, so yes it is not in sync and you need a little trick. Put 20-30 M400 before @execute so queue is filled up with it and at least one M400 got executed. Then it will execute more in time.
  • Thank you - that works perfectly now. 
Sign In or Register to comment.