-
-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: gcode_shell_command: option to terminate or not subprocess #237
base: master
Are you sure you want to change the base?
Conversation
default is true (same behavior as now)
I can update the doc if you want to |
Hi, thanks for contributing. I haven't tried it yet but is it not possible to call an external shell script and inside there, start subprocesses as you wish? In any case, if your idea makes sense and we merge it, we definitely need an example in the docs i would say. |
Hi ! Sorry for the long answer, i'll try to be quicker now. I use this command to take pictures with gphoto. macro_timelapse.cfg : [gcode_shell_command gphoto_take_frame]
command: sh /home/pi/klipper_config/gphoto_take_snapshot.sh
timeout: 2.
verbose: True
terminate: False gphoto_take_snapshot.sh : #!/bin/sh
# UUID is generated in start script. Its a unique number for the print (actually is a datetime is seconds)
UUID=`cat /tmp/uuid`
DIR=/mnt/some-network-drive/klipper-timelapses/$UUID
mkdir -p $DIR
COUNT=`ls -l $DIR | egrep -v "^total " | wc -l`
COUNT=$((COUNT+1))
sudo gphoto2 --capture-image-and-download --filename=$DIR/$COUNT.jpg With the camera model I have, once the picture is taken, it takes a while before gphoto command returns. For what I've measured, the picture is taken around 1s but the command takes around 9s to return. Thats a lot of time for each layer. Thats why I set |
How does sudo work for you, I want to run a script for updating the firmware of the board, but sudo does not work for me, because it says that a password must be entered. sudo service klipper stop and sudo service klipper start not working. |
Hi @th33xitus,
I'm using
gcode_shell_command
to take a timelapse (with gphoto and an external camera plugged in usb). I set as many camera settings as possible in manual mode so the photography process is quite fast (less than 1s). But after that, I copy the image file to a network drive. This part takes up to 10 seconds.I dont want to pause the print job for something that can be made in background. So I just added a config for the
gcode_shell_command
in order to let the subprocess continue if I want to.I know that this is far from perfect (could may be add a second "safety" timeout to actually terminate the subprocess) but may be it could help other users.
Anyway, thank you for you work. Regards