Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make filament sensor status checks universal #411

Merged
merged 4 commits into from
Dec 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update logic to check if filament sensor is enabled.
Must check each potential filament sensor type to see if it is defined before checking its state to eliminate an undefined error.
tehniemer committed Dec 20, 2023
commit fc32d45f938e4565fe2ba70fe97fbca482b0c234
6 changes: 3 additions & 3 deletions macros/helpers/filament_swap.cfg
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ gcode:
{% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %}

{% if filament_sensor_enabled %}
{% if printer['filament_motion_sensor runout_sensor'].enabled or printer['filament_switch_sensor runout_sensor'].enabled %}
{% if (printer['filament_motion_sensor runout_sensor'] is defined and printer['filament_motion_sensor runout_sensor'].enabled) or (printer['filament_switch_sensor runout_sensor'] is defined and printer['filament_switch_sensor runout_sensor'].enabled) %}
SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0
{% set re_enable_filament_sensor = 1 %}
{% if verbose %}
@@ -87,7 +87,7 @@ gcode:
{% set re_enable_filament_sensor = 0 %}

{% if filament_sensor_enabled %}
{% if printer['filament_motion_sensor runout_sensor'].enabled or printer['filament_switch_sensor runout_sensor'].enabled %}
{% if (printer['filament_motion_sensor runout_sensor'] is defined and printer['filament_motion_sensor runout_sensor'].enabled) or (printer['filament_switch_sensor runout_sensor'] is defined and printer['filament_switch_sensor runout_sensor'].enabled) %}
SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0
{% set re_enable_filament_sensor = 1 %}
{% if verbose %}
@@ -150,7 +150,7 @@ gcode:
{% set re_enable_filament_sensor = 0 %}

{% if filament_sensor_enabled %}
{% if printer['filament_motion_sensor runout_sensor'].enabled or printer['filament_switch_sensor runout_sensor'].enabled %}
{% if (printer['filament_motion_sensor runout_sensor'] is defined and printer['filament_motion_sensor runout_sensor'].enabled) or (printer['filament_switch_sensor runout_sensor'] is defined and printer['filament_switch_sensor runout_sensor'].enabled) %}
SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0
{% set re_enable_filament_sensor = 1 %}
{% if verbose %}
2 changes: 1 addition & 1 deletion macros/helpers/nozzle_cleaning.cfg
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@ gcode:
{% endif %}

{% if filament_sensor_enabled %}
{% if printer['filament_motion_sensor runout_sensor'].enabled or printer['filament_switch_sensor runout_sensor'].enabled %}
{% if (printer['filament_motion_sensor runout_sensor'] is defined and printer['filament_motion_sensor runout_sensor'].enabled) or (printer['filament_switch_sensor runout_sensor'] is defined and printer['filament_switch_sensor runout_sensor'].enabled) %}
SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0
{% set re_enable_filament_sensor = 1 %}
{% endif %}
2 changes: 1 addition & 1 deletion macros/helpers/prime_line.cfg
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ gcode:
{% endif %}

{% if filament_sensor_enabled %}
{% if printer['filament_motion_sensor runout_sensor'].enabled or printer['filament_switch_sensor runout_sensor'].enabled %}
{% if (printer['filament_motion_sensor runout_sensor'] is defined and printer['filament_motion_sensor runout_sensor'].enabled) or (printer['filament_switch_sensor runout_sensor'] is defined and printer['filament_switch_sensor runout_sensor'].enabled) %}
SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0
{% set re_enable_filament_sensor = 1 %}
{% endif %}