feature custom snapshot_cmd implemented#154
Open
boecko wants to merge 4 commits into
Open
Conversation
example:
[webcam canon]
location: printer
icon:
enabled: False
stream_url: /webcam/stream
snapshot_url: cmd:/home/pi/bin/canoncaptureframe
--- canoncaptureframe ---
BASEFILE=${1%%.jpg}
gphoto2 --quiet --capture-image-and-download --filename="$BASEFILE.%C"
--force-overwrite
rm -f "$BASEFILE.cr3"
---
example for DSLR via gphoto [timelapse] park_time: 0.6 snapshot_cmd: /home/pi/bin/gphoto2_capture.sh snapshot_cmd_check: /home/pi/bin/gphoto2_check.sh #optional use_snapshot_cmd: True
This was referenced Feb 24, 2024
Open
|
Hi, how would you go about combining this with the gcode shell command? |
|
I have these macros: [gcode_macro TAKE_SNAPSHOT]
description: Saves current location, moves toolhead to rear of bed, and takes a snapshot before returning.
gcode:
{% set delayMS = 2000 %} ; Delay after moving and before taking the snapshot, deals with buffering so we don't get the print head in motion
{% set snapshotPositionX = printer.toolhead.axis_maximum.x / 2 %} ; Middle of bed
{% set snapshotPositionY = printer.toolhead.axis_maximum.y - 5 %} ; rear of bed w/ some buffer
{% set currentX = printer.gcode_move.gcode_position.x %}
{% set currentY = printer.gcode_move.gcode_position.y %}
{% set currentZ = printer.gcode_move.gcode_position.z %} ; could be used for z-hop which we are not doing in this macro, so it's best to run this in AFTER_LAYER_CHANGE
{% set snapshotPositionZ = printer.gcode_move.gcode_position.z + 5 %}
SAVE_GCODE_STATE NAME=take_snapshot_state
{% if printer.extruder.can_extrude|lower == 'true' %}
G10 ; retract
{% endif %}
G90
G0 X{snapshotPositionX} Y{snapshotPositionY} Z{snapshotPositionZ} F5000.0 ;Move to snapshot position
G4 P{delayMS} ; Dwell for delayMS seconds
RUN_SHELL_COMMAND CMD=gphoto2_trigger_snapshot
G0 X{currentX} Y{currentY} Z {currentZ} F5000.0 ;Return to original position
{% if printer.extruder.can_extrude|lower == 'true' %}
G11 ; unretract
{% endif %}
RESTORE_GCODE_STATE NAME=take_snapshot_state
[gcode_macro GPHOTO_SNAPSHOT_TEST]
gcode:
RUN_SHELL_COMMAND CMD=gphoto_triggerAlong with this shell command cfg file: #=====================================================
# SET CAMERA SAVE LOCATION
#=====================================================
[gcode_shell_command gphoto2_set_config]
command: gphoto2 --set-config capturetarget=1
timeout: 1. ; make sure this is long enough to account for focus time
verbose: False
#=====================================================
# DSLR CAPTURE IMAGE
#=====================================================
[gcode_shell_command gphoto2_trigger_snapshot]
command: gphoto2 --auto-detect --trigger-capture
timeout: 10. ; make sure this is long enough to account for focus time
verbose: FalseAnd I'm using TAKE_SNAPSHOT in my slicer after every line. I saw in #155 to do: [timelapse]
use_gphoto2=TrueBut you have to download the .sh files to your pi for that - it would be much simpler to use the cfg files, so is this possible? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces 4 new timelapse-options .
It allows making timelapses via invocation of a custom shellscript.
In my case i'm using gphoto2 to control a Canon EOS70D camara.
It
use_snapshot_cmdisFalseorsnapshot_cmd_checkfails, the normal configuration is used.