Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [gcode_macro TIMELAPSE_TAKE_FRAME]
- description: Take Timelapse shoot
- variable_enable: False
- variable_takingframe: False
- variable_park: {'enable': False,
- 'pos' : 'center',
- 'time' : 0.1,
- 'custom': {'x': 0, 'y': 0, 'dz': 0},
- 'coord' : {'x': 0, 'y': 0, 'dz': 0}}
- variable_extruder: {'fw_retract': False,
- 'retract': 1.0,
- 'extrude': 1.0}
- variable_speed: {'travel': 100,
- 'retract': 15,
- 'extrude': 15}
- variable_verbose: True
- variable_restore: {'absolute': {'coordinates': True, 'extrude': True}, 'speed': 1500, 'e':0, 'factor': {'speed': 1.0, 'extrude': 1.0}}
- variable_macro: {'pause': 'PAUSE', 'resume': 'RESUME'}
- variable_is_paused: False
- gcode:
- {% set hyperlapse = True if params.HYPERLAPSE and params.HYPERLAPSE|lower =='true' else False %}
- {% if enable %}
- {% if (hyperlapse and printer['gcode_macro HYPERLAPSE'].run) or
- (not hyperlapse and not printer['gcode_macro HYPERLAPSE'].run) %}
- {% if park.enable %}
- {% set pos = {'x': park.coord.x, 'y': park.coord.y,
- 'z': [printer.gcode_move.gcode_position.z + park.coord.dz, printer.toolhead.axis_maximum.z]|min} %}
- {% set restore = {'absolute': {'coordinates': printer.gcode_move.absolute_coordinates,
- 'extrude' : printer.gcode_move.absolute_extrude},
- 'speed' : printer.gcode_move.speed,
- 'e' : printer.gcode_move.gcode_position.e,
- 'factor' : {'speed' : printer.gcode_move.speed_factor,
- 'extrude': printer.gcode_move.extrude_factor}} %}
- SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=restore VALUE="{restore}"
- {% if not printer[printer.toolhead.extruder].can_extrude %}
- {% if verbose %}{action_respond_info("Timelapse: Warning, minimum extruder temperature not reached!")}{% endif %}
- {% else %}
- {% if extruder.fw_retract %}
- G10
- {% else %}
- M83 ; insure relative extrusion
- G0 E-{extruder.retract} F{speed.retract * 60}
- {% endif %}
- {% endif %}
- SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=is_paused VALUE=True
- {macro.pause} ; execute the klipper PAUSE command
- SET_GCODE_OFFSET X=0 Y=0 ; this will insure that the head parks always at the same position in a multi setup
- G90 ; insure absolute move
- {% if "xyz" not in printer.toolhead.homed_axes %}
- {% if verbose %}{action_respond_info("Timelapse: Warning, axis not homed yet!")}{% endif %}
- {% else %}
- G0 X{pos.x} Y{pos.y} Z{pos.z} F{speed.travel * 60}
- {% endif %}
- SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=takingframe VALUE=True
- UPDATE_DELAYED_GCODE ID=_WAIT_TIMELAPSE_TAKE_FRAME DURATION=0.5
- M400
- {% endif %}
- _TIMELAPSE_NEW_FRAME HYPERLAPSE={hyperlapse}
- {% endif %}
- {% else %}
- {% if verbose %}{action_respond_info("Timelapse: disabled, take frame ignored")}{% endif %}
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement