External commands run before print is finished?

Hi everyone,

I wrote a .py script (printerOff) as per the external commands instructions to toggle a relay attached to my Rasppi, works great to turn the printer off with button click in the Repetier Server menu.  Additionally in the extcommands.xml I added a <execute> command and confirmed that it also works when I manually enter "@execute printerOff" in the gcode console.

When I add @execute printerOff into the "run after job" section of the event dependent gcodes section, the printer shuts off before the last layer is completely finished, and the still hot remains on the part although my end script in Simplfy3d as follows:

M104 S0 ; turn off extruder

M140 S0 ; turn off bed

G1 X0 Y200 F2400 ; prepare for part removal

M84 ; disable motors

M106 S0 ; Turn off Part Fan

When I take out the @execute script from Repetier Server the print finished and the nozzle and bed finish their end movements. I have even tried putting in: G4 S60, in both Simplfy3d and the "run after job" section in Repetier Server to see if a delay would help but the printer still shuts a few seconds before the last layer is finished.

Anyone have any tips?

Thank and regards,

Jay

Comments

  • You need to trick out the send ahead buffer. So first add a M400 after last move so moves are finshed. At then end before your execute add 20 times
    G4 S1

    that will wait in total 20 seconds minus what gets send ahead. Some printers need active cooling when finished for a while so maybe add first delay longer or if you do not want delay use P1 for 1 millisecond instead. Now when it reaches execute all important commands are executed.
  • That works, thanks!
Sign In or Register to comment.