Skip to content

Commit

Permalink
globals: Allow placeholders in start_end_park_y
Browse files Browse the repository at this point in the history
  • Loading branch information
jschuh committed Jun 5, 2023
1 parent b53e538 commit 0d866c8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -910,9 +910,11 @@ These are the customization options you can add to your
smaller or thinner beds you may want to reduce this value or disable it
entirely by setting it to `0.0`.

* `variable_start_end_park_y` *(default: `print_max` Y coordinate)* - The final
Y position of the toolhead in the `PRINT_END` macro, to ensure that the
toolhead is out of the way when the bed is presented for print removal.
* `variable_start_end_park_y` *(default: `max`)* - The final Y position of the
toolhead in the `PRINT_END` macro, to ensure that the toolhead is out of the
way when the bed is presented for print removal. This can be set to a Y
coordinate (e.g. `0.0`), `max` to use `stepper_y.position_max`, or `min` to
use `stepper_y.position_min`.

* `variable_start_extruder_preheat_scale` *(default: 0.5)* - This value is
multiplied by the target extruder temperature and the result is used as the
Expand Down
17 changes: 9 additions & 8 deletions globals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ variable_start_bed_heat_delay: 2000
variable_start_bed_heat_overshoot: 2.0
# Set to clear adjustments (e.g. feedrate, extrusion, heater) at end of print.
variable_start_clear_adjustments_at_end: True
# Final Y position of toolhead in PRINT_END. Defaults to print_max Y.
variable_start_end_park_y: 0.0
# PRINT_END Y park position (set "max" or "min" to infer from stepper config).
variable_start_end_park_y: 0.0 # Defaults to print_max Y.
# Extruder scale factor during pre-warmup in PRINT_START.
variable_start_extruder_preheat_scale: 0.5
# If non-zero the extruder will stabilize at this temp before probing the bed.
Expand Down Expand Up @@ -184,6 +184,13 @@ gcode:
{% set dummy = options.__setitem__("park_y",
printer.configfile.settings.stepper_y.position_max) %}
{% endif %}
{% if options.start_end_park_y|default("")|string|lower == "min" %}
{% set dummy = options.__setitem__("start_end_park_y",
printer.configfile.settings.stepper_y.position_min) %}
{% elif options.start_end_park_y|default("")|string|lower == "max" %}
{% set dummy = options.__setitem__("start_end_park_y",
printer.configfile.settings.stepper_y.position_max) %}
{% endif %}
{% if options.park_z|default("")|string|lower == "min" %}
{% set dummy = options.__setitem__("park_z",
printer.configfile.settings.stepper_z.position_min) %}
Expand Down Expand Up @@ -230,12 +237,6 @@ gcode:
{% endif %}
{% endfor %}

# Defaults that can alias to a user override.
{% if "print_max" in options and "start_end_park_y" not in options %}
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=start_end_park_y VALUE="{
options.print_max[1] }"
{% endif %}

{% if "homing_override" in printer.configfile.config %}
{% for l in printer.configfile.config.homing_override.gcode.split("\n") %}
{% if " g28 " in (" " ~ l.split("\x23")[0].split(";")[0]|lower ~ " ") %}
Expand Down

0 comments on commit 0d866c8

Please sign in to comment.