Skip to content

Commit 79b8847

Browse files
vovodroidthinkyhead
authored andcommitted
✨ Two controller fans (MarlinFirmware#24995)
1 parent 86a3362 commit 79b8847

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Marlin/Configuration_adv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@
538538
//#define USE_CONTROLLER_FAN
539539
#if ENABLED(USE_CONTROLLER_FAN)
540540
//#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan
541+
//#define CONTROLLER_FAN2_PIN -1 // Set a custom pin for second controller fan
541542
//#define CONTROLLER_FAN_USE_Z_ONLY // With this option only the Z axis is considered
542543
//#define CONTROLLER_FAN_IGNORE_Z // Ignore Z stepper. Useful when stepper timeout is disabled.
543544
#define CONTROLLERFAN_SPEED_MIN 0 // (0-255) Minimum speed. (If set below this value the fan is turned off.)

Marlin/src/feature/controllerfan.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ uint8_t ControllerFan::speed;
4040

4141
void ControllerFan::setup() {
4242
SET_OUTPUT(CONTROLLER_FAN_PIN);
43+
#ifdef CONTROLLER_FAN2_PIN
44+
SET_OUTPUT(CONTROLLER_FAN2_PIN);
45+
#endif
4346
init();
4447
}
4548

@@ -95,6 +98,13 @@ void ControllerFan::update() {
9598
hal.set_pwm_duty(pin_t(CONTROLLER_FAN_PIN), speed);
9699
else
97100
WRITE(CONTROLLER_FAN_PIN, speed > 0);
101+
102+
#ifdef CONTROLLER_FAN2_PIN
103+
if (PWM_PIN(CONTROLLER_FAN2_PIN))
104+
hal.set_pwm_duty(pin_t(CONTROLLER_FAN2_PIN), speed);
105+
else
106+
WRITE(CONTROLLER_FAN2_PIN, speed > 0);
107+
#endif
98108
#endif
99109
}
100110
}

0 commit comments

Comments
 (0)