⚡️ Handle shared enable pins (#22824)
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
#if ENABLED(USE_CONTROLLER_FAN)
|
||||
|
||||
#include "controllerfan.h"
|
||||
#include "../module/stepper/indirection.h"
|
||||
#include "../module/stepper.h"
|
||||
#include "../module/temperature.h"
|
||||
|
||||
ControllerFan controllerFan;
|
||||
@@ -54,33 +54,12 @@ void ControllerFan::update() {
|
||||
if (ELAPSED(ms, nextMotorCheck)) {
|
||||
nextMotorCheck = ms + 2500UL; // Not a time critical function, so only check every 2.5s
|
||||
|
||||
#define MOTOR_IS_ON(A,B) (A##_ENABLE_READ() == bool(B##_ENABLE_ON))
|
||||
#define _OR_ENABLED_E(N) || MOTOR_IS_ON(E##N,E)
|
||||
|
||||
const bool motor_on = (
|
||||
( DISABLED(CONTROLLER_FAN_IGNORE_Z) &&
|
||||
( MOTOR_IS_ON(Z,Z)
|
||||
|| TERN0(HAS_Z2_ENABLE, MOTOR_IS_ON(Z2,Z))
|
||||
|| TERN0(HAS_Z3_ENABLE, MOTOR_IS_ON(Z3,Z))
|
||||
|| TERN0(HAS_Z4_ENABLE, MOTOR_IS_ON(Z4,Z))
|
||||
)
|
||||
) || (
|
||||
DISABLED(CONTROLLER_FAN_USE_Z_ONLY) &&
|
||||
( MOTOR_IS_ON(X,X) || MOTOR_IS_ON(Y,Y)
|
||||
|| TERN0(HAS_X2_ENABLE, MOTOR_IS_ON(X2,X))
|
||||
|| TERN0(HAS_Y2_ENABLE, MOTOR_IS_ON(Y2,Y))
|
||||
#if E_STEPPERS
|
||||
REPEAT(E_STEPPERS, _OR_ENABLED_E)
|
||||
#endif
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// If any triggers for the controller fan are true...
|
||||
// - At least one stepper driver is enabled
|
||||
// - The heated bed is enabled
|
||||
// - TEMP_SENSOR_BOARD is reporting >= CONTROLLER_FAN_MIN_BOARD_TEMP
|
||||
if ( motor_on
|
||||
const ena_mask_t axis_mask = TERN(CONTROLLER_FAN_USE_Z_ONLY, _BV(Z_AXIS), ~TERN0(CONTROLLER_FAN_IGNORE_Z, _BV(Z_AXIS)));
|
||||
if ( (stepper.axis_enabled.bits & axis_mask)
|
||||
|| TERN0(HAS_HEATED_BED, thermalManager.temp_bed.soft_pwm_amount > 0)
|
||||
|| TERN0(HAS_CONTROLLER_FAN_MIN_BOARD_TEMP, thermalManager.wholeDegBoard() >= CONTROLLER_FAN_MIN_BOARD_TEMP)
|
||||
) lastMotorOn = ms; //... set time to NOW so the fan will turn on
|
||||
|
||||
Reference in New Issue
Block a user