Two controller fans (#24995)

This commit is contained in:
Vovodroid
2022-12-10 17:03:54 +02:00
committed by Scott Lahteine
parent 86a3362bf6
commit 79b88471f0
2 changed files with 11 additions and 0 deletions

View File

@ -40,6 +40,9 @@ uint8_t ControllerFan::speed;
void ControllerFan::setup() {
SET_OUTPUT(CONTROLLER_FAN_PIN);
#ifdef CONTROLLER_FAN2_PIN
SET_OUTPUT(CONTROLLER_FAN2_PIN);
#endif
init();
}
@ -95,6 +98,13 @@ void ControllerFan::update() {
hal.set_pwm_duty(pin_t(CONTROLLER_FAN_PIN), speed);
else
WRITE(CONTROLLER_FAN_PIN, speed > 0);
#ifdef CONTROLLER_FAN2_PIN
if (PWM_PIN(CONTROLLER_FAN2_PIN))
hal.set_pwm_duty(pin_t(CONTROLLER_FAN2_PIN), speed);
else
WRITE(CONTROLLER_FAN2_PIN, speed > 0);
#endif
#endif
}
}