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