enclosure fan control

This commit is contained in:
Siwat Sirichai 2024-01-03 03:03:10 +07:00
parent 3b37994e18
commit dab18e13f6
1 changed files with 11 additions and 8 deletions

View File

@ -294,7 +294,7 @@ activate_gcode:
# Fan Control
#####################################################################
[fan]
[fan_generic part_cooling_fan]
## Print Cooling Fan - CNC_FAN0
pin: !PA4
kick_start_time: 0
@ -492,12 +492,15 @@ gcode:
[gcode_macro M106]
gcode:
# P0: Part cooling fan, P3: Exhaust fan
{% if params.P == 0 %}
M106 S{ (params.S | int) }
{% elif params.P == 3 %}
SET_FAN_SPEED FAN=exhaust_fan SPEED={ (params.S | int)/255.0 }
{% endif %}
# If no P parameter is given, assume Part Cooling Fan
{% set speed = (params.S|float / 255 if params.S is defined else 1.0) %}
{% set fan_id = (params.P)|int if params.P is defined else 0 %}
{% if fan_id == 0 %}
SET_FAN_SPEED FAN=part_cooling_fan SPEED={speed}
{% elif fan_id == 3 %}
SET_FAN_SPEED FAN=exhaust_fan SPEED={speed}
{% endif %}
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
@ -512,4 +515,4 @@ gcode:
#*#
#*# [extruder]
#*#
#*# [heater_bed]
#*# [heater_bed]