Hi @Roij
Orca uses M106 command in order to activate some cooling fans and others.
These fans must be defined as fan_generic, not output_pins.
In my case, i have a IDEX printer, with multiple fans, so i had to redefine this command.
Anyways, i send you an example:
This is one of my fans:
# Filament fan
[fan_generic ventilador_capa_T0_IZQ]
pin: EBBCan_0: FAN1
kick_start_time: 0.5
off_below: 0.3
cycle_time: 0.01
I dunno if you need to redefine M106 for your purposes, anyways, in case it is helpul for you, this is my m106 configuration:
# Definition of variables for managing multiple part cooling fans.
[gcode_macro FAN_VARIABLE]
gcode:
variable_active_fan: 0 # Default active fan is 0 (can be adjusted based on T0/T1 selection).
###################################################################
# M106 - ACTIVATE FANS IN IDEX
###################################################################
[gcode_macro M106]
# This macro overrides the "M106" command to allow control of multiple extruder fans in an IDEX setup.
# It dynamically selects the correct fan based on the extruder in use or based on the P parameter passed.
gcode:
{% set fan_vars = printer["gcode_macro FAN_VARIABLE"] %}
{% set raw_speed = params.S|default(0)|float %}
{% set fan_speed = (raw_speed / 255.0)|round(2) %} # Convert fan speed from 0-255 range to percentage (0-1)
# Select the target fan based on parameter P or the currently active fan
# This allows the correct fan to be activated for the active extruder.
{% set target_fan = params.P|default(fan_vars.active_fan)|int %}
# Control the fan speed for the active extruder or based on the P parameter.
# This ensures the correct fan is activated during printing, depending on the active extruder or mode.
{% if target_fan in [0,1,2,3,4] %}
### Controls the print fan for the active carriage or both for mirror/duplication mode.
CARRIAGE_PRINT_FAN SPEED={fan_speed} TARGET={target_fan}
{% endif %}
[gcode_macro M107]
# This macro overrides the default M107 command to allow control of multiple extruders in an IDEX setup.
# It uses the fan control system to turn off the active fan for the current extruder, or the fan specified by parameter P.
gcode:
{% set fan_vars = printer["gcode_macro FAN_VARIABLE"] %}
{% set target_fan = params.P|default(fan_vars.active_fan)|int %}
M106 S0 P{target_fan} # Turns off the active fan by setting its speed to 0 (equivalent to M107).
###################################################################
# CARRIAGE_PRINT_FAN - ACTIVATION OF FANS IN IDEX
###################################################################
[gcode_macro CARRIAGE_PRINT_FAN]
# This macro automatically sets the print fan speed for different operating modes.
# It selects the correct fan and sets the speed based on the active extruder or the target fan specified.
# This macro is called via M106 and M107 commands and in the activation of extruders, via T0,T1, and mirror and copy modes
gcode:
{% set fan_vars = printer["gcode_macro FAN_VARIABLE"] %}
# Determine the target fan based on parameters or use the default active fan
{% if params.TARGET is defined %}
{% set target_fan = params.TARGET|int %}
{% else %}
{% set target_fan = fan_vars.active_fan %}
{% endif %}
# Set the fan speed if provided, otherwise retrieve the current speed of the target fan
{% if params.SPEED is defined %}
{% set fan_speed = params.SPEED|float %} # Use the provided speed if available
{% else %}
# If no speed is provided, get the current speed of the selected fan
{% if target_fan == 0 %}
{% set fan_speed = printer["fan_generic ventilador_capa_T0_IZQ"].speed|float %}
{% elif target_fan == 1 %}
{% set fan_speed = printer["fan_generic ventilador_capa_T1_IZQ"].speed|float %}
# Possible part cooling fan for extra cooling purposes
#{% elif target_fan == 2 %}
#{% set fan_speed = printer["fan_generic cooling_part"].speed|float %}
# Air extractor fan
{% elif target_fan == 3 %}
{% set fan_speed = printer["fan_generic ventilador_extractor"].speed|float %}
### For mirror or duplication mode, set the maximum speed between the fans of T0 and T1.
{% elif target_fan == 4 %}
{% set fans_T0_speed = printer["fan_generic ventilador_capa_T0_IZQ"].speed|float %}
{% set fans_T1_speed = printer["fan_generic ventilador_capa_T1_IZQ"].speed|float %}
{% set fan_speed = [fans_T0_speed, fans_T1_speed]|max %} # Use the maximum speed between T0 and T1 fans.
{% else %}
# If no valid target fan is found, set the fan speed to 0 for safety.
{% set fan_speed = 0 %}
{% endif %}
{% endif %}
# Activate the appropriate fans based on the selected target fan.
{% if target_fan == 0 %}
### Fans on carriage X1 (extruder T0).
SET_FAN_SPEED FAN=ventilador_capa_T0_IZQ SPEED={fan_speed} # Activate the left fan of T0.
SET_FAN_SPEED FAN=ventilador_capa_T0_DCHA SPEED={fan_speed} # Activate the right fan of T0.
{% elif target_fan == 1 %}
### Fans on carriage X2 (extruder T1).
SET_FAN_SPEED FAN=ventilador_capa_T1_IZQ SPEED={fan_speed} # Activate the left fan of T1.
SET_FAN_SPEED FAN=ventilador_capa_T1_DCHA SPEED={fan_speed} # Activate the right fan of T1.
{% elif target_fan == 2 %}
### Possible auxiliary fan for part cooling
{% elif target_fan == 3 %}
### Air extractor fan
SET_FAN_SPEED FAN=ventilador_extractor SPEED={fan_speed} # Activate the air extractor fan
{% elif target_fan == 4 %}
### Fans on both carriages for mirror/duplication mode.
SET_FAN_SPEED FAN=ventilador_capa_T0_IZQ SPEED={fan_speed} # Activate all fans for T0 and T1.
SET_FAN_SPEED FAN=ventilador_capa_T0_DCHA SPEED={fan_speed}
SET_FAN_SPEED FAN=ventilador_capa_T1_IZQ SPEED={fan_speed}
SET_FAN_SPEED FAN=ventilador_capa_T1_DCHA SPEED={fan_speed}
{% endif %}
Also, i need to activate the active fan in T0 and T1 calls so when orca commands just M106 and speed, it works properly:
For example:
[gcode_macro T0]
# Activate main extruder (T0)
gcode:
G91 # Set to relative movement mode
G1 Z0.4 F1800 # Raise the head slightly to avoid collisions
G90 # Return to absolute movement mode
PARK_extruder1 # Parks extruder 1 to avoid future collisions
ACTIVATE_EXTRUDER EXTRUDER=extruder # Activates extruder 0
SET_DUAL_CARRIAGE CARRIAGE=0 # Selects extruder carriage 0
# Save the mode
SET_GCODE_VARIABLE MACRO=MODES_VARIABLE VARIABLE=mode VALUE='"T0"'
# Added for handling M106 fans
SET_GCODE_VARIABLE MACRO=FAN_VARIABLE VARIABLE=active_fan VALUE=0 # Controls extruder 0 fan
CARRIAGE_PRINT_FAN TARGET=0 # Activates the carriage fan
I hope it was helpful