Advertisement
rootiest

1entreprenewer.cfg

Dec 28th, 2022
1,172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.51 KB | None | 0 0
  1. #=====================================================
  2. # MANUAL SET CAPTURE TARGET
  3. #=====================================================
  4. [gcode_macro GPHOTO_SET_TARGET]
  5. gcode:
  6.    RUN_SHELL_COMMAND CMD=gphoto2_set_config
  7.  
  8. #=====================================================
  9. # ENABLE TIMELAPSE
  10. #=====================================================
  11. [gcode_macro ENABLE_TIMELAPSE]
  12. description: enables or disables timelapse functionality by using a variable.
  13. variable_enabled: 0
  14. gcode:
  15.    {% set new_state= params.VALUE|default(1)|int %}
  16.     SET_GCODE_VARIABLE MACRO=ENABLE_TIMELAPSE VARIABLE=enabled VALUE={new_state}
  17.  
  18. #=====================================================
  19. # TAKE SNAPSHOT COMMAND
  20. #=====================================================
  21. [gcode_macro TAKE_SNAPSHOT]
  22. description: Saves current location, moves toolhead to rear of bed, and takes a snapshot before returning.
  23. gcode:
  24.    {% if printer["gcode_macro ENABLE_TIMELAPSE"].enabled is 1 %}
  25.         {% set delayMS = 2000 %} ; Delay after moving and before taking the snapshot, deals with buffering so we don't get the print head in motion
  26.         {% set snapshotPositionX = printer.toolhead.axis_maximum.x / 2 %} ; Middle of bed
  27.         {% set snapshotPositionY = printer.toolhead.axis_maximum.y - 5 %} ; rear of bed w/ some buffer
  28.         {% set currentX = printer.gcode_move.gcode_position.x %}
  29.         {% set currentY = printer.gcode_move.gcode_position.y %}
  30.         {% 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
  31.         SAVE_GCODE_STATE NAME=take_snapshot_state ; save current state
  32.         {% if printer.extruder.can_extrude|lower == 'true' %}
  33.             G10 ; retract
  34.         {% endif %}
  35.         G90 ; absolute positioning
  36.         G0 X{snapshotPositionX} Y{snapshotPositionY} F25000.0 ;Move to snapshot position
  37.         G4 P{delayMS} ; Dwell for delayMS seconds
  38.         RUN_SHELL_COMMAND CMD=gphoto2_trigger_snapshot
  39.         G0 X{currentX} Y{currentY} F25000.0 ;Return to original position
  40.         {% if printer.extruder.can_extrude|lower == 'true' %}
  41.             G11 ; unretract
  42.         {% endif %}
  43.         RESTORE_GCODE_STATE NAME=take_snapshot_state ; restore saved state
  44.     {% endif %}
  45.  
  46. #=====================================================
  47. # MANUAL SNAPSHOT TEST
  48. #=====================================================
  49. [gcode_macro GPHOTO_SNAPSHOT_TEST]
  50. gcode:
  51.    RUN_SHELL_COMMAND CMD=gphoto2_trigger_snapshot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement