-
Notifications
You must be signed in to change notification settings - Fork 5
/
motors_sync.cfg
29 lines (29 loc) · 1.36 KB
/
motors_sync.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
[gcode_macro SYNC_MOTORS]
rename_existing: SYNC_MOTORS_BASE
gcode:
{% set axes = params.AXES|default('default')|string|lower %}
{% set retry_tolerance = params.RETRY_TOLERANCE|default('default')|string|lower %}
{% set retries = params.THRESHOLD_RETRIES|default('default')|string|lower %}
{% set force_run = params.FORCE_RUN|default(0)|int %}
{% if not printer.motors_sync.applied or force_run %}
{% if axes == 'default' %}
{% set axes = printer.configfile.config.motors_sync.axes %}
{% endif %}
{% if retry_tolerance == 'default' %}
{% if 'retry_tolerance' in printer.configfile.config.motors_sync %}
{% set retry_tolerance = printer.configfile.config.motors_sync.retry_tolerance %}
{% else %}
{% set retry_tolerance = 0 %}
{% endif %}
{% endif %}
{% if retries == 'default' %}
{% if 'retries' in printer.configfile.config.motors_sync %}
{% set retries = printer.configfile.config.motors_sync.retries %}
{% else %}
{% set retries = 0 %}
{% endif %}
{% endif %}
SYNC_MOTORS_BASE AXES={axes} RETRY_TOLERANCE={retry_tolerance} RETRIES={retries}
{% else %}
M118 Motors sync already applied! If you want force sync, run with FORCE_RUN=1 argument
{% endif %}