|
|
@ -27,6 +27,8 @@
|
|
|
|
#include "../module/stepper_indirection.h"
|
|
|
|
#include "../module/stepper_indirection.h"
|
|
|
|
#include "../module/temperature.h"
|
|
|
|
#include "../module/temperature.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t controllerFanSpeed;
|
|
|
|
|
|
|
|
|
|
|
|
void controllerfan_update() {
|
|
|
|
void controllerfan_update() {
|
|
|
|
static millis_t lastMotorOn = 0, // Last time a motor was turned on
|
|
|
|
static millis_t lastMotorOn = 0, // Last time a motor was turned on
|
|
|
|
nextMotorCheck = 0; // Last time the state was checked
|
|
|
|
nextMotorCheck = 0; // Last time the state was checked
|
|
|
@ -56,6 +58,7 @@ void controllerfan_update() {
|
|
|
|
|
|
|
|
|
|
|
|
// Fan off if no steppers have been enabled for CONTROLLERFAN_SECS seconds
|
|
|
|
// Fan off if no steppers have been enabled for CONTROLLERFAN_SECS seconds
|
|
|
|
uint8_t speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED;
|
|
|
|
uint8_t speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED;
|
|
|
|
|
|
|
|
controllerFanSpeed = speed;
|
|
|
|
|
|
|
|
|
|
|
|
// allows digital or PWM fan output to be used (see M42 handling)
|
|
|
|
// allows digital or PWM fan output to be used (see M42 handling)
|
|
|
|
WRITE(CONTROLLER_FAN_PIN, speed);
|
|
|
|
WRITE(CONTROLLER_FAN_PIN, speed);
|
|
|
|