-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
feature custom snapshot_cmd implemented #154
Open
boecko
wants to merge
4
commits into
mainsail-crew:main
Choose a base branch
from
boecko:feature/snapshotcmd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
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_trigger Along 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: False And I'm using TAKE_SNAPSHOT in my slicer after every line. I saw in #155 to do: [timelapse]
use_gphoto2=True But 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? |
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_cmd
isFalse
orsnapshot_cmd_check
fails, the normal configuration is used.