Klipper3d / klipper

Klipper is a 3d-printer firmware
GNU General Public License v3.0
9k stars 5.18k forks source link

Filament Sensors: Add switch_pin_state status variable #6378

Closed Gunner087 closed 8 months ago

Gunner087 commented 8 months ago

Added a switch_pin_state status variable to the RunoutHelper class. Variable state is modified by _button_handler() in SwitchSensor and encoder_event() in EncoderSensor.

This allows a macro to read the logic state of the switch_pin for filament_switch_sensor and filament_motion_sensor. In my case, I wanted this functionality in order to write a macro that tracks the motion of the filament during a purge in the START_PRINT macro. That way I can check if the extruder is working properly before the print starts. Checking filament extrusion during filament load or unload macros is also possible.

Gunner087 commented 8 months ago

Closed, found a better solution