-
Notifications
You must be signed in to change notification settings - Fork 4
/
homing.cfg
46 lines (43 loc) · 1.89 KB
/
homing.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
#####################################################################
# Homing definition
#####################################################################
[endstop_phase stepper_z]
#endstop_accuracy:
#trigger_phase:
#endstop_align_zero: False
#####################################################################
# Macros
#####################################################################
## conditional home
[gcode_macro SMARTHOME]
gcode:
{% if printer.toolhead.homed_axes != "xyz" %}
G28
{% endif %}
[gcode_macro _SET_ACC]
variable_accel: 0
variable_accel_to_decel: 0
variable_last_val: 'RUN'
gcode:
{% if VAL == 'HOME' %}
# store old values and apply home value
SET_GCODE_VARIABLE MACRO=_SET_ACC VARIABLE=accel VALUE={printer.toolhead.max_accel}
SET_GCODE_VARIABLE MACRO=_SET_ACC VARIABLE=accel_to_decel VALUE={printer.toolhead.max_accel_to_decel}
{% set accel = HOMING_ACCEL|default(500) %}
{% set accel_to_decel = HOMING_ACCEL %}
{% elif VAL == 'CONFIG' %}
# set all to config values
SET_GCODE_VARIABLE MACRO=_SET_ACC VARIABLE=accel VALUE={printer.configfile.settings.printer.max_accel}
SET_GCODE_VARIABLE MACRO=_SET_ACC VARIABLE=accel_to_decel VALUE={printer.configfile.settings.printer.max_accel}
{% set accel = printer.configfile.settings.printer.max_accel %}
{% set accel_to_decel = printer.configfile.settings.printer.max_accel %}
{% else %}
# load stored values
{% set accel = printer["gcode_macro _SET_ACC"].accel %}
{% set accel_to_decel = printer["gcode_macro _SET_ACC"].accel_to_decel %}
{% endif %}
{% if VAL != printer["gcode_macro _SET_ACC"].last_val|string %}
SET_GCODE_VARIABLE MACRO=_SET_ACC VARIABLE=last_val VALUE='"{VAL}"'
{action_respond_info("VELOCITY_LIMIT set ACCEL: %d ACCEL_TO_DECEL: %d" % (accel|int, accel_to_decel|int))}
SET_VELOCITY_LIMIT ACCEL={accel} ACCEL_TO_DECEL={accel_to_decel}
{% endif %}