Files
Macros/Scripts/aux_fan.cfg

57 lines
1.7 KiB
INI

[gcode_macro M106]
rename_existing: G106
gcode:
{% if params.P is defined %}
{% if params.P|int == 2 %}
{% if params.S is defined %}
{% if params.S|int == 255 %}
{% set realspeed = 1 %}
{% else %}
{% if params.S|int == 0 %}
{% set realspeed = 0 %}
{% else %}
{% set realspeed = params.S|float/255 %}
{% endif %}
{% endif %}
{% else %}
{% set realspeed = 1 %}
{% endif %}
SET_FAN_SPEED FAN=Aux_Fan SPEED={realspeed}
{% endif %}
{% if params.P|int == 1 %}
{% if params.S is defined %}
{% if params.S|int == 255 %}
{% set realspeed = 1 %}
{% else %}
{% if params.S|int == 0 %}
{% set realspeed = 0 %}
{% else %}
{% set realspeed = params.S|float/255 %}
{% endif %}
{% endif %}
{% else %}
{% set realspeed = 1 %}
{% endif %}
SET_FAN_SPEED FAN=Exhaust_fan SPEED={realspeed}
{% endif %}
{% else %}
{% if params.S is defined %}
G106 S{params.S}
{% else %}
G106 S255
{% endif %}
{% endif %}
[gcode_macro M107]
rename_existing: G107
gcode:
{% if params.P is defined %}
{% if params.P|int == 2 %}
SET_FAN_SPEED FAN=Aux_Fan SPEED=0
{% endif %}
{% else %}
SET_FAN_SPEED FAN=Aux_Fan SPEED=0
G107
{% endif %}