Fix / complete USE_CONTROLLER_FAN (#9666)
This commit is contained in:
parent
08d685c97a
commit
2d749d490b
|
@ -208,6 +208,10 @@ extern millis_t max_inactive_time, stepper_inactive_time;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(USE_CONTROLLER_FAN)
|
||||||
|
extern uint8_t controllerFanSpeed;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||||
extern int lpq_len;
|
extern int lpq_len;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -46,7 +46,7 @@ bool Power::is_power_needed() {
|
||||||
HOTEND_LOOP() if (thermalManager.autofan_speed[e] > 0) return true;
|
HOTEND_LOOP() if (thermalManager.autofan_speed[e] > 0) return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(AUTO_POWER_CONTROLLERFAN) && HAS_CONTROLLER_FAN
|
#if ENABLED(AUTO_POWER_CONTROLLERFAN) && HAS_CONTROLLER_FAN && ENABLED(USE_CONTROLLER_FAN)
|
||||||
if (controllerFanSpeed > 0) return true;
|
if (controllerFanSpeed > 0) return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue