auto power off an printer

Hi! I have an 3d printer with relay for on or off printer uses comand like bash /home/pi/scripts/printerOn.sh
and in extcommands.xmli has:
<execute name="play" allowParams="true">sh /home/pi/scripts/printerOn.sh</execute>
<execute name="off" allowParams="true">sh /home/pi/scripts/printerOff.sh</execute>
I want that after printing my printer will do off command but need wait about 30 min for cooldown extruder.
I dont know how i need do it.

Comments

  • Ok, will be a bit tricky. Especially since you want to undo that if you do a new print I guess. So here my untested solution.

    Write a test if printerOff.sh is running and kill it at the start of printerOn and Off.
    In printerOff add
    sleep 1800
    to wait 30 minutes before executing the disconnect string. That way each start will disable the off timeout. Server should start it async so it will not wait for the 30 minutes to finish but remembers that the script is running so it will not get killed.

    Some tips:
    sh is not needed if you set +x flag to the script and the first line in it is
    #!/bin/bash

    That way it should appear with it's own name as executeable and you could kill it with killall command.

    Also server runs all commands as user repetierserver so make sur ethat user has permission to read/execute the script and required software.
  • Repetier said:
    Ok, will be a bit tricky. Especially since you want to undo that if you do a new print I guess. So here my untested solution.

    Write a test if printerOff.sh is running and kill it at the start of printerOn and Off.
    In printerOff add
    sleep 1800
    to wait 30 minutes before executing the disconnect string. That way each start will disable the off timeout. Server should start it async so it will not wait for the 30 minutes to finish but remembers that the script is running so it will not get killed.

    Some tips:
    sh is not needed if you set +x flag to the script and the first line in it is
    #!/bin/bash

    That way it should appear with it's own name as executeable and you could kill it with killall command.

    Also server runs all commands as user repetierserver so make sur ethat user has permission to read/execute the script and required software.
    printeroff and printeron just switch relay:

    #!/bin/bash
    gpio mode 8 output
    gpio write 8 1

    and

    #!/bin/bash
    gpio mode 8 output
    gpio write 8 0
    I think that i make off file like:

    #!/bin/bash
    sleep 1800
    gpio mode 8 output
    gpio write 8 1

    and in endgcode on repetier-server add:
    @execute off


  • But that way you must wait 30 minutes before you start a new print! Or it will kill printer during print. That is what the killall idea was for.
  • I make off.sh file
    #!/bin/bash
    sleep 1800
    gpio mode 8 output
    gpio write 8 1

    and add in engcode:

    It off my printer after run the script. I test it in console: @execute off



  • Repetier said:
    But that way you must wait 30 minutes before you start a new print! Or it will kill printer during print. That is what the killall idea was for.
    Hmm. Very complicated.
  • Why is adding
    killall off.sh

    in on.sh complicated? Just one line that kills an evetually running off process so it will not trigger during print.
Sign In or Register to comment.