Skip to content

Commit

Permalink
Fix error with turning on filter only if it was used during printing. (
Browse files Browse the repository at this point in the history
…#406)

Fix issue discovered after merging #380
  • Loading branch information
tehniemer authored and Frix-x committed Feb 13, 2024
1 parent 26b9bb1 commit b5422ba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
9 changes: 8 additions & 1 deletion macros/base/cancel_print.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ gcode:
{% set light_enabled = printer["gcode_macro _USER_VARIABLES"].light_enabled %}
{% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %}
{% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %}
{% set filter_default_time = printer["gcode_macro _USER_VARIABLES"].filter_default_time_on_end_print|default(600)|int %}

PARK

Expand Down Expand Up @@ -41,8 +42,14 @@ gcode:

SDCARD_RESET_FILE

# If a filter is connected, and used during the print, continue filtering the air
# for a couple of min before stopping everything
{% if filter_enabled %}
STOP_FILTER
{% if printer['fan_generic filter'].speed > 0 %}
{% set FILTER_TIME = params.FILTER_TIME|default(filter_default_time)|int %}
START_FILTER SPEED=1
UPDATE_DELAYED_GCODE ID=_STOP_FILTER_DELAYED DURATION={FILTER_TIME}
{% endif %}
{% endif %}

{% if light_enabled %}
Expand Down
11 changes: 6 additions & 5 deletions macros/base/end_print.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ gcode:
{% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %}
{% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %}
{% set filter_default_time = printer["gcode_macro _USER_VARIABLES"].filter_default_time_on_end_print|default(600)|int %}
{% set filter_speed = printer["gcode_macro START_PRINT"].material.filter_speed|default(0)|int %}

PARK

Expand Down Expand Up @@ -47,10 +46,12 @@ gcode:

# If a filter is connected, and used during the print, continue filtering the air
# for a couple of min before stopping everything
{% if filter_enabled and filter_speed > 0 %}
{% set FILTER_TIME = params.FILTER_TIME|default(filter_default_time)|int %}
START_FILTER SPEED=1
UPDATE_DELAYED_GCODE ID=_STOP_FILTER_DELAYED DURATION={FILTER_TIME}
{% if filter_enabled %}
{% if printer['fan_generic filter'].speed > 0 %}
{% set FILTER_TIME = params.FILTER_TIME|default(filter_default_time)|int %}
START_FILTER SPEED=1
UPDATE_DELAYED_GCODE ID=_STOP_FILTER_DELAYED DURATION={FILTER_TIME}
{% endif %}
{% endif %}

{% if light_enabled %}
Expand Down

0 comments on commit b5422ba

Please sign in to comment.