-
Notifications
You must be signed in to change notification settings - Fork 9
/
M204.cfg
38 lines (35 loc) · 1.5 KB
/
M204.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
# This is useful when trying out new slicers and you can't eliminate some acceleration
# changes but if you have LOTS of accel changes it can eat too much CPU time and cause
# hard to track down crashes.
#
# ban setting accel above our hard limit
# allow setting with S or P perameters, ignore T as it MUST come with a P to be valid
# gcode and we only want the lower one
# Do not set to maximum if no perameters were given
# TODO only get chatty if naked M204 is sent as request for info
[gcode_macro M204]
description: Set ACCEL limieted by config and ACCEL_TO_DECEL as F x ACCEL
rename_existing: M204.1
#default_parameter_F: 0.5 #depricated, use default() filter
gcode:
{% set conf_max_accel = printer.configfile.settings.printer.max_accel|int %}
{% set F = params.F|default(0.5)|float %}
{% set S = params.S|default(0)|float %}
{% set P = params.P|default(0)|float %}
{% if 'S' in params %}
{% if params.S|int < conf_max_accel %}
SET_VELOCITY_LIMIT ACCEL={ S } ACCEL_TO_DECEL={ S|float * F|float }
{% else %}
SET_VELOCITY_LIMIT ACCEL={ conf_max_accel } ACCEL_TO_DECEL={ conf_max_accel|float * F|float }
#TODO notify
{% endif %}
{% endif %}
# Handle P syntax
{% if 'P' in params %}
{% if params.P|int < conf_max_accel %}
SET_VELOCITY_LIMIT ACCEL={ P } ACCEL_TO_DECEL={ P|float * F|float }
{% else %}
SET_VELOCITY_LIMIT ACCEL={ conf_max_accel } ACCEL_TO_DECEL={ conf_max_accel|float * F|float }
#TODO Notify
{% endif %}
{% endif %}