What is the problem?
Nothing i seem to put in the "After print job completes" seems to work.
What did you already try to solve it?
Cr10s Pro using the Cura slicer.
Currently, in Cura's 'End G-Code' section there is:
G91 ;Relative positioning
G1 E-4 Z20 F2400 ;Retract and raise Z
G90 ;Absolute positioning
G1 Y300;Present print
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
M140 S0 ;Turn-off bed
M84 X Y E ;Disable all steppers but Z
The above works fine and as expected.
The prblem comes when....
I have added a USB relay to control the power to the printer so that i can shut it down after prints complete. An easy task i thought.
Using the "GCODE System Command" plugin, i've created two commands...
OCTO901:
sleep 30
and...
OCTO900:
/home/pi/dev/scripts/power_cut.sh
power_cut.sh contains:
#!/bin/bash
sleep 60
gpio export 2 out
gpio -g write 2 1
echo "0" > /home/pi/dev/scripts/state
sh /home/pi/dev/scripts/usb_cut.sh &
usb_cut.sh contains:
#!/bin/bash
sleep 30
gpio export 3 out
gpio -g write 3 1
I then put in Octoprints 'After print job completes' section:
M400
OCTO901
M400
OCTO900
The issue...when the print completes...the print head never moves as per the Cura's 'End G-Code' script. If i do not use the OCTO codes, the Cura's 'End G-Code' executes fine. I've also verified that, when saved to a file, the gcode does contain Cura's 'End G-Code' script.
As a result the print head stays on the print and burns a hole into the print.
Things i've tried...
Just putting Cura's 'End G-Code' script into Octoprints 'After print job completes' section...same result. The print head stays on the print and burns a hole in it.
G91 ;Relative positioning
G1 E-4 Z20 F2400 ;Retract and raise Z
G90 ;Absolute positioning
G1 Y300;Present print
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
M140 S0 ;Turn-off bed
M84 X Y E ;Disable all steppers but Z
M400
OCTO901
M400
OCTO900
I've also noticed, that with short, lest than 1 minute test prints, the setup above works fine and the print head is lifted off the print at completion and the bed is moved all the way forward. But with actual prints that take hours...once complete, it seems like the end GCODE to lift the head and present the print doesn't execute.
I'm not a GCODE expert, but i'm all out of ideas on how to make this work.
All i want is, when the print is finished...
- the print head is lifted from the print
- octoprint executes the power_cut.sh script to activate the realy to cut power to the printer.
I feel like this should be fairly simple and maybe i'm just missing, or not understanding how GCODE works, but i'm out of ideas.
When i look at the logs...it seems that the OCTO commands get executed, but the then octoprint tires to send more commands after. This is where i'm getting confused. Are the commands not executed linearly? One line at a time in order? If thats the case...then OCTO900 (Call to execute power_cut.sh) should be the last command issued.
I'm at a loss, and frustrated. Please help me understand.
Logs from last print: https://www.dropbox.com/s/s58k3gj25vnj8ox/serial.log?dl=0