forked from jschuh/klipper-macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
velocity.cfg
86 lines (79 loc) · 2.8 KB
/
velocity.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Copyright (C) 2022 Justin Schuh <[email protected]>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro m201]
description: Sets maximum accelleration.
Usage: M201 [X<accel>] [Y<accel>]
variable_max_accel: 1.7976931348623157e+308
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
{% if 'X' in params or 'Y' in params %}
{% set accel = (params.X|default(params.Y)|float,
params.Y|default(params.X)|float)|min %}
SET_GCODE_VARIABLE MACRO=m201 VARIABLE=max_accel VALUE="{accel}"
{% if accel < printer.toolhead.max_accel %}
SET_VELOCITY_LIMIT ACCEL="{accel
}" ACCEL_TO_DECEL="{accel * km.velocity_decel_scale}"
{% endif %}
{% else %}
SET_VELOCITY_LIMIT
{% endif %}
[gcode_macro m203]
description: Sets maximum velocity.
Usage: M203 [X<velocity>] [Y<velocity>]
gcode:
{% if 'X' in params or 'Y' in params %}
{% set velocity = (params.X|default(params.Y)|float,
params.Y|default(params.X)|float)|min %}
SET_VELOCITY_LIMIT VELOCITY="{velocity}"
{% else %}
SET_VELOCITY_LIMIT
{% endif %}
[gcode_macro m204]
description: Sets maximum accelleration.
Usage: M204 [S<accel>] [P<accel> T<accel>]
rename_existing: M204.6245197
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
{% set max_accel = printer["gcode_macro m201"].max_accel %}
{% set accel = 0.0 %}
{% if 'S' in params %}
{% set accel = (params.S|float, max_accel)|min %}
{% elif 'P' in params %}
{% set accel = (params.P|float, params.T|default(params.P)|float,
max_accel)|min %}
{% endif %}
{% if accel %}
SET_VELOCITY_LIMIT ACCEL="{accel
}" ACCEL_TO_DECEL="{accel * km.velocity_decel_scale}"
{% else %}
SET_VELOCITY_LIMIT
{% endif %}
[gcode_macro m205]
description: Sets square corner velocity.
Usage: M203 [X<velocity>] [Y<velocity>]
gcode:
{% if 'X' in params or 'Y' in params %}
SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY="{
(params.X|default(0)|float, params.Y|default(0)|float)|min}"
{% else %}
SET_VELOCITY_LIMIT
{% endif %}
[gcode_macro m900]
description: Sets pressure advance.
Usage: M900 [K<advance>] [T<extruder_index>]
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
{% if km.pressure_advance_scale > 0.0 %}
{% set extruder = "extruder" ~ params.T|replace('0', '')
if "T" in params else printer.toolhead.extruder %}
{% if 'K' in params %}
SET_PRESSURE_ADVANCE EXTRUDER="{extruder}" ADVANCE="{
params.K|float * km.pressure_advance_scale}"
{% endif %}
{% endif %}
[gcode_macro _reset_velocity_limits]
description: Sets maximum accelleration.
Usage: M204 [S<accel>] [P<accel> T<accel>]
gcode:
SET_GCODE_VARIABLE MACRO=m201 VARIABLE=max_accel VALUE="{1.7976931348623157e+308}"