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
…Frix-x#406)

Fix issue discovered after merging Frix-x#380
  • Loading branch information
tehniemer authored and reineruhry committed Feb 13, 2024
1 parent 3fd6ed2 commit 517641e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 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
37 changes: 13 additions & 24 deletions macros/base/end_print.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@ gcode:
{% set turn_off_heaters_in_end_print = printer["gcode_macro _USER_VARIABLES"].turn_off_heaters_in_end_print %}
{% set safe_extruder_temp = printer["gcode_macro _USER_VARIABLES"].safe_extruder_temp|float %}
{% set light_intensity_end_print = printer["gcode_macro _USER_VARIABLES"].light_intensity_end_print %}
{% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %}
{% set mmu_unload = params.MMU_UNLOAD_AT_END|default(printer["gcode_macro _USER_VARIABLES"].mmu_unload_on_end_print)|int %}
{% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %}
{% set ercf_unload = params.ERCF_UNLOAD_AT_END|default(printer["gcode_macro _USER_VARIABLES"].ercf_unload_on_end_print)|int %}
{% set filter_enabled = printer["gcode_macro _USER_VARIABLES"].filter_enabled %}
{% 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 %}
{% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %}
{% set filter_speed = printer["gcode_macro START_PRINT"].material.filter_speed|default(0)|int %}

PARK

{% if klippain_mmu_enabled %}
{% if printer.mmu.enabled and mmu_unload %}
# unload filament and park into MMU. Or just unload filament out of extruder if using bypass.
MMU_EJECT
{% if klippain_ercf_enabled and ercf_unload %}
{% if printer.ercf.enabled %}
# unload filament and park into ercf
ERCF_EJECT
{% endif %}
{% else %}
# pull back the filament a little bit
Expand Down Expand Up @@ -48,26 +46,17 @@ 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 %}
LIGHT_ON S={light_intensity_end_print}
{% endif %}
{% if status_leds_enabled %}
STATUS_LEDS COLOR="DONE_PRINTING"
STATUS_LEDS COLOR="OFF"
{% endif %}

{% if klippain_mmu_enabled %}
{% if printer.mmu.enabled and printer.mmu.print_start_detection|int == 0 %}
_MMU_PRINT_END
{% endif %}
{% endif %}

# If a filament sensor is connected, re-enable it in case it was disabled during printing
{% if filament_sensor_enabled %}
SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1
{% endif %}

0 comments on commit 517641e

Please sign in to comment.