Files
Macros/Scripts/idle.cfg

76 lines
2.9 KiB
INI

[idle_timeout]
timeout: 120
gcode:
RESPOND MSG="Idle start"
UPDATE_DELAYED_GCODE ID=_FIRST_STAGE_IDLE DURATION={printer["gcode_macro RatOS"].idle_delay}
[delayed_gcode _FIRST_STAGE_IDLE]
gcode:
{% if printer.idle_timeout.state == "Idle" or printer.idle_timeout.state == "Ready" %}
{% if printer.extruder.temperature < 50.0 and printer.heater_bed.temperature < 50.0 %}
{% if printer.extruder.target == 0.0 and printer.heater_bed.target == 0.0 %}
UPDATE_DELAYED_GCODE ID=_FIRST_STAGE_IDLE DURATION=0
{% if printer.toolhead.homed_axes is defined %}
{% if printer["gcode_macro RatOS"].tgbot_enabled|lower == 'true' %}
RESPOND PREFIX=tgnotify MSG="Моторы погашены"
{% endif %}
M84
{% endif %}
UPDATE_DELAYED_GCODE ID=_POWER_OFF_PRINTER_CHECK DURATION={printer["gcode_macro RatOS"].poweroff_delay}
{% else %}
UPDATE_DELAYED_GCODE ID=_FIRST_STAGE_IDLE DURATION=2
{% endif %}
{% else %}
{% if printer.idle_timeout.state == "Printing" %}
UPDATE_DELAYED_GCODE ID=_FIRST_STAGE_IDLE DURATION=0
{% else %}
{% if printer.extruder.target == 0.0 and printer.heater_bed.target == 0.0 %}
UPDATE_DELAYED_GCODE ID=_FIRST_STAGE_IDLE DURATION=2
{% else %}
UPDATE_DELAYED_GCODE ID=_FIRST_STAGE_IDLE DURATION=0
{% endif %}
{% endif %}
{% endif %}
{% endif %}
[delayed_gcode _POWER_OFF_PRINTER_CHECK]
gcode:
{% if printer.idle_timeout.state == "Idle" or printer.idle_timeout.state == "Ready" %}
{% if printer.extruder.temperature < 50.0 and printer.heater_bed.temperature < 50.0 %}
{% if printer.extruder.target == 0.0 and printer.heater_bed.target == 0.0 %}
UPDATE_DELAYED_GCODE ID=_POWER_OFF_PRINTER_CHECK DURATION=0
{% if printer["gcode_macro RatOS"].tgbot_enabled|lower == 'true' %}
RESPOND PREFIX=tgnotify MSG="Питание принтера выключено"
{% endif %}
_POWER_OFF_PRINTER
{% else %}
UPDATE_DELAYED_GCODE ID=_POWER_OFF_PRINTER_CHECK DURATION=2
{% endif %}
{% else %}
{% if printer.idle_timeout.state == "Printing" %}
UPDATE_DELAYED_GCODE ID=_POWER_OFF_PRINTER_CHECK DURATION=0
{% else %}
{% if printer.extruder.target == 0.0 and printer.heater_bed.target == 0.0 %}
UPDATE_DELAYED_GCODE ID=_POWER_OFF_PRINTER_CHECK DURATION=2
{% else %}
UPDATE_DELAYED_GCODE ID=_POWER_OFF_PRINTER_CHECK DURATION=0
{% endif %}
{% endif %}
{% endif %}
{% endif %}
[delayed_gcode _EXHAUST_FAN_DELAYED]
gcode:
SET_FAN_SPEED FAN=Exhaust_fan SPEED=0
RESPOND MSG="Вытяжка остановлена"
{% if printer["gcode_macro RatOS"].tgbot_enabled|lower == 'true' %}
RESPOND PREFIX=tgnotify MSG="Вытяжка остановлена"
{% endif %}
[gcode_macro _POWER_OFF_PRINTER]
gcode:
{action_call_remote_method("set_device_power",
device=printer["gcode_macro RatOS"].power_device,
state="off")}