Files
klipper-macros/macros/sensors/motion_sensor.cfg
T
mangavalkandClaude Opus 5.5 f25f348d0b Motion lights outside the G-code queue (extras/motion_lights.py)
The AM312 case light and nozzle LEDs waited for long commands (heat waits,
AFC loads, QGL) because [gcode_button] runs through the G-code queue. The
new module reads the pin itself, keeps the timeout on a reactor timer and
sets the case light with output_pin's send_async_request and the nozzle
LEDs directly on the led_effect object. CASELIGHT and _LIGHTS_ON keep
working; _STATUS_SHOW reads printer.motion_lights.near.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 00:35:26 +01:00

33 lines
1.6 KiB
INI

# PIR motion sensor (AM312): case light and nozzle LEDs while someone is near
#
# Handled by extras/motion_lights.py, outside the G-code queue: the lights
# react at once, also during heat waits, AFC loads and other long commands
# (with [gcode_button] they waited for those to finish).
#
# The AM312 keeps its output on as long as it sees movement. The timeout
# starts when the motion stops, so the lights stay on while someone works at
# the printer.
#
# someone near: case light near_value, nozzle LEDs white
# nobody near, print/pause: case light print_value, nozzle LEDs off
# nobody near, idle: case light idle_value, nozzle LEDs off,
# logo and Box Turtle logo dim (_STATUS ready)
#
# CASELIGHT MODE=ON [VALUE=0.5] | OFF | AUTO overrides the sensor until the
# next Klipper restart; CASELIGHT alone shows the state. _LIGHTS_ON turns the
# lights on as if someone walked by (print start and end, resume).
# MOTION_LIGHTS_DEBUG ENABLE=1 reports every change in the console. Setting
# the case light in Mainsail lasts until the next change.
[motion_lights]
pin: !PC0
light: caselight
nozzle_effect: sb_nozzle_light
timeout: 60 # s without motion before the lights dim or turn off
near_value: 1.0 # case light while someone is near
print_value: 0.1 # case light while printing or paused, nobody near
idle_value: 0.0 # case light while idle, nobody near
on_value: 1.0 # case light for CASELIGHT MODE=ON
fade_time: 0.5 # nozzle LED fade (s), same as _STATUS fade_time
status_gcode: _STATUS # night mode of the logo when nobody is near