timelapse

This commit is contained in:
Kyle Brown 2022-06-11 12:24:15 -07:00
parent 4641c27079
commit 150807803e
6 changed files with 224 additions and 191 deletions

View file

@ -1,180 +1,195 @@
[gcode_macro MEASURE_RESONNANCES_X] [gcode_macro MEASURE_RESONNANCES_X]
gcode: gcode:
RESPOND PREFIX= MSG="Homing" RESPOND PREFIX= MSG="Homing"
G28 G28
Dock_probe Dock_probe
RESPOND PREFIX= MSG="Measuring resonnances on X Axis" RESPOND PREFIX= MSG="Measuring resonnances on X Axis"
SHAPER_CALIBRATE AXIS=X SHAPER_CALIBRATE AXIS=X
#Park_toolhead #Park_toolhead
[gcode_macro MEASURE_RESONNANCES_Y] [gcode_macro MEASURE_RESONNANCES_Y]
gcode: gcode:
RESPOND PREFIX= MSG="Homing" RESPOND PREFIX= MSG="Homing"
G28 G28
Dock_probe Dock_probe
RESPOND PREFIX= MSG="Measuring resonnances on Y Axis" RESPOND PREFIX= MSG="Measuring resonnances on Y Axis"
SHAPER_CALIBRATE AXIS=Y SHAPER_CALIBRATE AXIS=Y
#Park_toolhead #Park_toolhead
[gcode_macro Screws_tilt] [gcode_macro Screws_tilt]
gcode: gcode:
{% set travel_speed = printer["gcode_macro GlobalVariables"].travel_speed %} {% set travel_speed = printer["gcode_macro GlobalVariables"].travel_speed %}
{% set home_x = printer["gcode_macro GlobalVariables"].home_x %} {% set home_x = printer["gcode_macro GlobalVariables"].home_x %}
{% set probe_x_offset = printer["gcode_macro GlobalVariables"].probe_x_offset %} {% set probe_x_offset = printer["gcode_macro GlobalVariables"].probe_x_offset %}
{% set BED_TEMP = params.BED_TEMP|default(100)|float %} {% set BED_TEMP = params.BED_TEMP|default(100)|float %}
# Start bed heating and wait # Start bed heating and wait
RESPOND PREFIX= MSG="Waiting for bed temperature..." RESPOND PREFIX= MSG="Waiting for bed temperature..."
M140 S{BED_TEMP} M140 S{BED_TEMP}
{% if printer.toolhead.homed_axes != 'xyz' %} {% if printer.toolhead.homed_axes != 'xyz' %}
G28 #Home All Axes G28 #Home All Axes
{% endif %} {% endif %}
G4 P15000 G4 P15000
M190 S{BED_TEMP} M190 S{BED_TEMP}
Attach_probe Attach_probe
SCREWS_TILT_CALCULATE samples=3 SCREWS_TILT_CALCULATE samples=3
G1 X{ home_x - probe_x_offset } Y230 Z200 F{ travel_speed } G1 X{ home_x - probe_x_offset } Y230 Z200 F{ travel_speed }
[gcode_macro M900] [gcode_macro M900]
gcode: gcode:
# Parameters # Parameters
{% set pa = params.K|float %} {% set pa = params.K|float %}
SET_PRESSURE_ADVANCE ADVANCE={pa} SET_PRESSURE_ADVANCE ADVANCE={pa}
[gcode_macro FLOW_CALIBRATION] [gcode_macro FLOW_CALIBRATION]
gcode: gcode:
M221 S{params.FLOW} M221 S{params.FLOW}
SET_PRESSURE_ADVANCE ADVANCE={params.PRESSURE_ADVANCE} SET_PRESSURE_ADVANCE ADVANCE={params.PRESSURE_ADVANCE}
[gcode_macro SEARCH_VARS] [gcode_macro SEARCH_VARS]
gcode: gcode:
{% set search = params.S|lower %} {% set search = params.S|lower %}
{% set ns = namespace() %} {% set ns = namespace() %}
{% for item in printer %} {% for item in printer %}
{% if ' ' in item %} {% if ' ' in item %}
{% set ns.path = ['printer', "['%s']" % (item), ''] %} {% set ns.path = ['printer', "['%s']" % (item), ''] %}
{% else %} {% else %}
{% set ns.path = ['printer.', item, ''] %} {% set ns.path = ['printer.', item, ''] %}
{% endif %} {% endif %}
{% if search in ns.path|lower %} {% if search in ns.path|lower %}
{ action_respond_info(ns.path|join) } { action_respond_info(ns.path|join) }
{% endif %} {% endif %}
{% if printer[item].items() %} {% if printer[item].items() %}
{% for childkey, child in printer[item].items() recursive %} {% for childkey, child in printer[item].items() recursive %}
{% set ns.path = ns.path[:loop.depth|int + 1] %} {% set ns.path = ns.path[:loop.depth|int + 1] %}
{% if ' ' in childkey %} {% if ' ' in childkey %}
{% set null = ns.path.append("['%s']" % (childkey)) %} {% set null = ns.path.append("['%s']" % (childkey)) %}
{% else %} {% else %}
{% set null = ns.path.append(".%s" % (childkey)) %} {% set null = ns.path.append(".%s" % (childkey)) %}
{% endif %} {% endif %}
{% if child is mapping %} {% if child is mapping %}
{ loop(child.items()) } { loop(child.items()) }
{% else %} {% else %}
{% if search in ns.path|lower %} {% if search in ns.path|lower %}
{ action_respond_info("%s : %s" % (ns.path|join, child)) } { action_respond_info("%s : %s" % (ns.path|join, child)) }
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
# Home, get position, throw around toolhead, home again. [gcode_macro TEST_Z_DOWN]
# If MCU stepper positions (first line in GET_POSITION) are greater than a full step different (your number of microsteps), then skipping occured. gcode:
# We only measure to a full step to accomodate for endstop variance. {% set amount = params.amount|default(1)|int %}
# Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10 TESTZ Z=-{amount}
[gcode_macro TEST_SPEED]
gcode: [gcode_macro TEST_Z_UP]
# Speed gcode:
{% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} {% set amount = params.amount|default(1)|int %}
# Iterations TESTZ Z=+{amount}
{% set iterations = params.ITERATIONS|default(5)|int %}
# Acceleration [gcode_macro TEST_Z_UP_MIDDLE]
{% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} gcode:
# Bounding box (in case the machine min/maxes are not perfect) TESTZ Z=+
{% set bound = params.BOUND|default(20)|int %}
[gcode_macro TEST_Z_DOWN_MIDDLE]
# Set speed test bounds (machine minimum/maximum positions, inset by the bounding box) gcode:
{% set x_min = printer.toolhead.axis_minimum.x + bound %} TESTZ Z=-
{% set x_max = printer.toolhead.axis_maximum.x - bound %}
{% set y_min = printer.toolhead.axis_minimum.y + bound %} # Home, get position, throw around toolhead, home again.
{% set y_max = printer.toolhead.axis_maximum.y - bound %} # If MCU stepper positions (first line in GET_POSITION) are greater than a full step different (your number of microsteps), then skipping occured.
# We only measure to a full step to accomodate for endstop variance.
G28 # Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10
DOCK_PROBE
# Save current gcode state (absolute/relative, etc) [gcode_macro TEST_SPEED]
SAVE_GCODE_STATE NAME=TEST_SPEED gcode:
# Speed
# Absolute positioning {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %}
G90 # Iterations
{% set iterations = params.ITERATIONS|default(5)|int %}
# Set new limits # Acceleration
SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %}
# Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions)
# Home and get position for comparison later: {% set bound = params.BOUND|default(20)|int %}
G28 X Y # Size for small pattern box
# QGL if not already QGLd (only if QGL section exists in config) {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %}
{% if printer.configfile.settings.quad_gantry_level %}
{% if printer.quad_gantry_level.applied == False %} # Large pattern
QUAD_GANTRY_LEVEL # Max positions, inset by BOUND
G28 Z {% set x_min = printer.toolhead.axis_minimum.x + bound %}
{% endif %} {% set x_max = printer.toolhead.axis_maximum.x - bound %}
{% endif %} {% set y_min = printer.toolhead.axis_minimum.y + bound %}
G0 X{printer.toolhead.axis_maximum.x} Y{printer.toolhead.axis_maximum.y} F{30 * 60} {% set y_max = printer.toolhead.axis_maximum.y - bound %}
G4 P1000
GET_POSITION # Small pattern at center
# Find X/Y center point
# Go to starting position {% set x_center = (printer.toolhead.axis_minimum.x|float + printer.toolhead.axis_maximum.x|float ) / 2 %}
G0 X{x_min} Y{y_min} Z{bound + 10} F{speed * 60} {% set y_center = (printer.toolhead.axis_minimum.y|float + printer.toolhead.axis_maximum.y|float ) / 2 %}
{% for i in range(iterations) %} # Set small pattern box around center point
# Diagonals {% set x_center_min = x_center - (smallpatternsize/2) %}
G0 X{x_min} Y{y_min} F{speed * 60} {% set x_center_max = x_center + (smallpatternsize/2) %}
G0 X{x_max} Y{y_max} F{speed * 60} {% set y_center_min = y_center - (smallpatternsize/2) %}
G0 X{x_min} Y{y_min} F{speed * 60} {% set y_center_max = y_center + (smallpatternsize/2) %}
G0 X{x_max} Y{y_min} F{speed * 60}
G0 X{x_min} Y{y_max} F{speed * 60} # Save current gcode state (absolute/relative, etc)
G0 X{x_max} Y{y_min} F{speed * 60} SAVE_GCODE_STATE NAME=TEST_SPEED
# Box # Output parameters to g-code terminal
G0 X{x_min} Y{y_min} F{speed * 60} { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) }
G0 X{x_min} Y{y_max} F{speed * 60}
G0 X{x_max} Y{y_max} F{speed * 60} # Absolute positioning
G0 X{x_max} Y{y_min} F{speed * 60} G90
{% endfor %}
# Set new limits
# Restore max speed/accel/accel_to_decel to their configured values SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel}
SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel}
# Home and get position for comparison later:
# Re-home XY and get position again for comparison: G28
G28 X Y
# Go to XY home positions (in case your homing override leaves it elsewhere) # Go to starting position
G0 X{printer.toolhead.axis_maximum.x} Y{printer.toolhead.axis_maximum.y} F{30 * 60} G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60}
G4 P1000
GET_POSITION {% for i in range(iterations) %}
# Large pattern
# Restore previous gcode state (absolute/relative, etc) # Diagonals
RESTORE_GCODE_STATE NAME=TEST_SPEED G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_max} Y{y_max} F{speed*60}
[gcode_macro TEST_Z_DOWN] G0 X{x_min} Y{y_min} F{speed*60}
gcode: G0 X{x_max} Y{y_min} F{speed*60}
{% set amount = params.amount|default(1)|int %} G0 X{x_min} Y{y_max} F{speed*60}
TESTZ Z=-{amount} G0 X{x_max} Y{y_min} F{speed*60}
[gcode_macro TEST_Z_UP] # Box
gcode: G0 X{x_min} Y{y_min} F{speed*60}
{% set amount = params.amount|default(1)|int %} G0 X{x_min} Y{y_max} F{speed*60}
TESTZ Z=+{amount} G0 X{x_max} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
[gcode_macro TEST_Z_UP_MIDDLE]
gcode: # Small pattern
TESTZ Z=+ # Small diagonals
G0 X{x_center_min} Y{y_center_min} F{speed*60}
[gcode_macro TEST_Z_DOWN_MIDDLE] G0 X{x_center_max} Y{y_center_max} F{speed*60}
gcode: G0 X{x_center_min} Y{y_center_min} F{speed*60}
TESTZ Z=- G0 X{x_center_max} Y{y_center_min} F{speed*60}
G0 X{x_center_min} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
# Small box
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_min} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
{% endfor %}
# Restore max speed/accel/accel_to_decel to their configured values
SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel}
# Restore previous gcode state (absolute/relative, etc)
RESTORE_GCODE_STATE NAME=TEST_SPEED

View file

@ -84,8 +84,8 @@ rename_existing: BASE_PAUSE
gcode: gcode:
#Edit this# #Edit this#
{% set X = 230 %} {% set X = 230 %}
{% set Y = 230 %} {% set Y = 200 %}
{% set Z = 10 %} {% set Z = 30 %}
########### ###########
SAVE_GCODE_STATE NAME=PAUSE_state SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE BASE_PAUSE

View file

@ -5,18 +5,23 @@ enable_debug_logging: False
config_path: ~/klipper_config config_path: ~/klipper_config
log_path: ~/klipper_logs log_path: ~/klipper_logs
[timelapse]
[authorization] [authorization]
cors_domains: cors_domains:
https://my.mainsail.xyz https://my.mainsail.xyz
http://my.mainsail.xyz http://my.mainsail.xyz
http://*.local http://*.local
http://*.lan http://*.lan
http://*.home
http://*.far
trusted_clients: trusted_clients:
10.0.0.0/8 10.0.0.0/8
127.0.0.0/8 127.0.0.0/8
169.254.0.0/16 169.254.0.0/16
172.16.0.0/12 172.16.0.0/12
192.168.0.0/16 192.168.0.0/16
192.168.25.0/24
FE80::/10 FE80::/10
::1/128 ::1/128
@ -32,4 +37,11 @@ trusted_clients:
[update_manager mainsail] [update_manager mainsail]
type: web type: web
repo: meteyou/mainsail repo: meteyou/mainsail
path: ~/mainsail path: ~/mainsail
[update_manager timelapse]
type: git_repo
primary_branch: main
path: ~/moonraker-timelapse
origin: https://github.com/mainsail-crew/moonraker-timelapse.git

View file

@ -14,7 +14,6 @@ gcode:
#LIGHTS_ON #LIGHTS_ON
M190 S{bedTemp} # Wait for bed to come to temperature M190 S{bedTemp} # Wait for bed to come to temperature
RESPOND PREFIX= MSG="Waiting for thermal expansion..." RESPOND PREFIX= MSG="Waiting for thermal expansion..."
M117 Waiting for thermal expansion...
HEATSOAK DWELL={DWELL} # Dwelling HEATSOAK DWELL={DWELL} # Dwelling
# Homing and creating a mesh # Homing and creating a mesh
@ -35,6 +34,7 @@ gcode:
[gcode_macro HEATSOAK] [gcode_macro HEATSOAK]
gcode: gcode:
M117 Waiting for thermal expansion...
G4 P{params.DWELL|int*1000} G4 P{params.DWELL|int*1000}
[gcode_macro LIGHT_DISPLAY] [gcode_macro LIGHT_DISPLAY]

View file

@ -5,6 +5,7 @@
[include calibration_macros.cfg] [include calibration_macros.cfg]
[include klipper-mini12864.cfg] [include klipper-mini12864.cfg]
[include dock_macros.cfg] [include dock_macros.cfg]
[include timelapse.cfg]
[pause_resume] [pause_resume]
[respond] [respond]
@ -93,7 +94,7 @@ fade_target: 0
pin: PC15 pin: PC15
x_offset: 0.0 x_offset: 0.0
y_offset: 34.5 y_offset: 34.5
z_offset = 6.300 z_offset = 6.275
speed: 25 speed: 25
samples_result: median samples_result: median
samples_tolerance: 0.05 samples_tolerance: 0.05
@ -151,17 +152,16 @@ pid_kd = 1260.320
min_temp: 0 min_temp: 0
max_temp: 120 max_temp: 120
[thermistor chamber_temp] [thermistor custom_chamber]
temperature1: 10 temperature1: 8
resistance1: 100000 resistance1: 100000
temperature2: 150 temperature2: 144
resistance2: 1074 resistance2: 1074
temperature3: 300 temperature3: 284
resistance3: 82.78 resistance3: 82.78
[temperature_sensor chamber] [temperature_sensor chamber]
#sensor_type: chamber_temp sensor_type: custom_chamber
sensor_type: ATC Semitec 104NT-4-R025H42G
sensor_pin: PA6 sensor_pin: PA6
min_temp: 0 min_temp: 0
max_temp: 200 max_temp: 200
@ -246,6 +246,11 @@ accel_chip: adxl345
probe_points: probe_points:
125,119,20 125,119,20
[firmware_retraction]
retract_length: 0.2
retract_speed: 80
unretract_speed: 80
[input_shaper] [input_shaper]
shaper_type_x = mzv shaper_type_x = mzv
shaper_freq_x = 51.0 shaper_freq_x = 51.0

1
timelapse.cfg Symbolic link
View file

@ -0,0 +1 @@
/home/pi/moonraker-timelapse/klipper_macro/timelapse.cfg