Skip to content

Commit

Permalink
Feature: Add user configurable delayed_gcode interval
Browse files Browse the repository at this point in the history
  • Loading branch information
zellneralex committed Nov 28, 2023
1 parent 57bec0d commit b9c713e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
18 changes: 18 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,21 @@ Component will grab the frame of the Streamer.
To do so, please refer to the documentation of your Image:
- MainsailOS: https://crowsnest.mainsail.xyz/configuration/cam-section#resolution
- FluiddPI: https://docs.fluidd.xyz/features/cameras

## Reduce the check interval inside the klipper macros
The default is that the macros check every 0.5 sec if the print can continue.
This is a good compromise between cpu load and quality. From now one you can change
this time.
Caution, smaller numbers increase the risk of a klipper "timer to close"

To change it simple, add the following GCODE to your print start:
```ini
SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=check_time VALUE=0.5
```

To get that change at every klipper start:
```ini
[delayed_gcode _INIT_TIMELAPSE_CHECK_TIME]
initial_duration: 1
gcode: SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=check_time VALUE=0.5
```
9 changes: 6 additions & 3 deletions klipper_macro/timelapse.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license
#
# Macro version 1.14
# Macro version 1.15
#

##### DO NOT CHANGE ANY MACRO!!! #####
Expand Down Expand Up @@ -215,6 +215,8 @@ gcode:
##
## verbose: Enable mesage output of TIMELAPSE_TAKE_FRAME
##
## check_time: time when the status of the taken picture is checked. Default 0.5 sec
##
## restore.absolute.coordinates: internal use
## restore.absolute.extrude : internal use
## restore.speed : internal use
Expand Down Expand Up @@ -243,6 +245,7 @@ variable_speed: {'travel': 100,
'retract': 15,
'extrude': 15}
variable_verbose: True
variable_check_time: 0.5
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
Expand Down Expand Up @@ -282,7 +285,7 @@ gcode:
G0 {pos.x} {pos.y} {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
UPDATE_DELAYED_GCODE ID=_WAIT_TIMELAPSE_TAKE_FRAME DURATION={check_time}
M400
{% endif %}
_TIMELAPSE_NEW_FRAME HYPERLAPSE={hyperlapse}
Expand All @@ -303,7 +306,7 @@ gcode:
{% set tl = printer['gcode_macro TIMELAPSE_TAKE_FRAME'] %}
{% set factor = {'speed': printer.gcode_move.speed_factor, 'extrude': printer.gcode_move.extrude_factor} %}
{% if tl.takingframe %}
UPDATE_DELAYED_GCODE ID=_WAIT_TIMELAPSE_TAKE_FRAME DURATION=0.5
UPDATE_DELAYED_GCODE ID=_WAIT_TIMELAPSE_TAKE_FRAME DURATION={tl.check_time}
{% else %}
{tl.macro.resume} VELOCITY={tl.speed.travel} ; execute the klipper RESUME command
SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=is_paused VALUE=False
Expand Down

0 comments on commit b9c713e

Please sign in to comment.