Event_delay in filament_switch_sensor not doing what I think?

Basic Information:

Printer Model: VCore3 CoreXY

Describe your issue:

Hello, I have a simple switch set up as “spool present” safety switch as another filament_switch_sensor in Klipper. This is working fine, but sometimes (spool loosing weight during longer print) it can happen that the switch trips for a short time and recovers. This then trips the filament_switch_sensor even though I had the understanding that event_delay would effectively work as debounce? Even when I manually off/on the switch for just 0,5s and set event_delay=10.0 I get immediate execution of the associated gcode.

Has someone a solution to my problem (other than adding electronics to take care of debouncing) maybe? Eventually an intermediate gcode macro with setting up a timer and saving the switch state might work, but that sounds pretty overkill for such a feature.

I also wonder what the event_delay actually does, because I dont see any difference in current behaviour, disregarding what value I choose for it, the gcode in the filament switch is immediately run after I open the switch.

Greetings and thanks for reading :slight_smile:

I found a solution by using a delay gcode:

[filament_switch_sensor Spool_sensor]
switch_pin: !Z3_Pin
pause_on_runout: False
runout_gcode:
    UPDATE_DELAYED_GCODE ID=CHECK_SPOOL DURATION=1 #trigger the delayed gcode below after 1 s
pause_delay: 0.5
event_delay: 3.0

[delayed_gcode CHECK_SPOOL]
initial_duration: 0
gcode:
    {% if printer["filament_switch_sensor Spool_sensor"].filament_detected == True %}
        #{action_respond_info("Spool on!")}
    {% else %}
        {action_respond_info("Spool lost!")}
        M601
    {% endif %}
1 Like