Files
klipper-macros/macros/sensors/motion_sensor.cfg
T
mangavalkandClaude Opus 5.5 eaf9c82617 Group macros by topic, add Blobifier, fix first tool change
- Split the macro files into folders by topic (print, heating, afc,
  pressure_advance, spoolman, leds, sensors); klipper-macros.cfg is the
  one file printer.cfg includes. Macros moved unchanged; the effective
  config is identical apart from the paths of the PA shell scripts.
- Add the modified Blobifier (Turtleblobifier for AFC) and define
  [save_variables] once in save_variables.cfg instead of in both
  blobifier.cfg and the PA macros (same file, bd_pa_variables.cfg).
- PRINT_WARMUP: heat to the loaded lane's temperature before the first
  tool change. AFC skips heating when the loaded lane's tool number is
  not in the print file's temperature list, and the unload then failed
  below min_extrude_temp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 14:24:37 +02:00

43 lines
1.1 KiB
INI

# PIR motion sensor: case light on when someone is near the printer
[gcode_button am312]
pin: !PC0
press_gcode:
_motion_detected
[gcode_macro _motion_detected]
description: Motion sensor triggered
gcode:
{% set printing = printer.print_stats.state == "printing" %}
# RESPOND MSG="AM312: Motion detected"
{% if printing %}
# RESPOND MSG="AM312: Printer is printing -> light ON (100%)"
SET_PIN PIN=caselight VALUE=1.0
_set_nozzle_leds_on
{% else %}
# RESPOND MSG="AM312: Printer idle -> light ON (10%)"
SET_PIN PIN=caselight VALUE=0.1
_set_nozzle_leds_off
{% endif %}
# RESPOND MSG="AM312: Resetting timeout to 30 seconds"
UPDATE_DELAYED_GCODE ID=_motion_timeout DURATION=30
[delayed_gcode _motion_timeout]
gcode:
{% set printing = printer.print_stats.state == "printing" %}
# RESPOND MSG="AM312: Timeout reached, no motion"
{% if printing %}
# RESPOND MSG="AM312: Printing -> dim light to 10%"
SET_PIN PIN=caselight VALUE=0.1
{% else %}
# RESPOND MSG="AM312: Idle -> light OFF"
SET_PIN PIN=caselight VALUE=0.0
{% endif %}
_set_nozzle_leds_off