🩹 Relocate Fan conditionals, sanity-checks (#25731)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
95cfc98fe4
commit
ce85b98db4
|
@ -1233,17 +1233,6 @@
|
||||||
#define CANNOT_EMBED_CONFIGURATION defined(__AVR__)
|
#define CANNOT_EMBED_CONFIGURATION defined(__AVR__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fan Kickstart
|
|
||||||
#if FAN_KICKSTART_TIME && !defined(FAN_KICKSTART_POWER)
|
|
||||||
#define FAN_KICKSTART_POWER 180
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if FAN_MIN_PWM == 0 && FAN_MAX_PWM == 255
|
|
||||||
#define CALC_FAN_SPEED(f) (f ?: FAN_OFF_PWM)
|
|
||||||
#else
|
|
||||||
#define CALC_FAN_SPEED(f) (f ? map(f, 1, 255, FAN_MIN_PWM, FAN_MAX_PWM) : FAN_OFF_PWM)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Input shaping
|
// Input shaping
|
||||||
#if EITHER(INPUT_SHAPING_X, INPUT_SHAPING_Y)
|
#if EITHER(INPUT_SHAPING_X, INPUT_SHAPING_Y)
|
||||||
#define HAS_ZV_SHAPING 1
|
#define HAS_ZV_SHAPING 1
|
||||||
|
|
|
@ -2719,37 +2719,8 @@
|
||||||
#define HAS_FAN 1
|
#define HAS_FAN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* Part Cooling fan multipliexer
|
|
||||||
*/
|
|
||||||
#if PIN_EXISTS(FANMUX0)
|
#if PIN_EXISTS(FANMUX0)
|
||||||
#define HAS_FANMUX 1
|
#define HAS_FANMUX 1 // Part Cooling fan multipliexer
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MIN/MAX fan PWM scaling
|
|
||||||
*/
|
|
||||||
#ifndef FAN_OFF_PWM
|
|
||||||
#define FAN_OFF_PWM 0
|
|
||||||
#endif
|
|
||||||
#ifndef FAN_MIN_PWM
|
|
||||||
#if FAN_OFF_PWM > 0
|
|
||||||
#define FAN_MIN_PWM (FAN_OFF_PWM + 1)
|
|
||||||
#else
|
|
||||||
#define FAN_MIN_PWM 0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#ifndef FAN_MAX_PWM
|
|
||||||
#define FAN_MAX_PWM 255
|
|
||||||
#endif
|
|
||||||
#if FAN_MIN_PWM < 0 || FAN_MIN_PWM > 255
|
|
||||||
#error "FAN_MIN_PWM must be a value from 0 to 255."
|
|
||||||
#elif FAN_MAX_PWM < 0 || FAN_MAX_PWM > 255
|
|
||||||
#error "FAN_MAX_PWM must be a value from 0 to 255."
|
|
||||||
#elif FAN_MIN_PWM > FAN_MAX_PWM
|
|
||||||
#error "FAN_MIN_PWM must be less than or equal to FAN_MAX_PWM."
|
|
||||||
#elif FAN_OFF_PWM > FAN_MIN_PWM
|
|
||||||
#error "FAN_OFF_PWM must be less than or equal to FAN_MIN_PWM."
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2773,6 +2744,35 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MIN/MAX fan PWM scaling
|
||||||
|
*/
|
||||||
|
#if EITHER(HAS_FAN, USE_CONTROLLER_FAN)
|
||||||
|
#ifndef FAN_OFF_PWM
|
||||||
|
#define FAN_OFF_PWM 0
|
||||||
|
#endif
|
||||||
|
#ifndef FAN_MIN_PWM
|
||||||
|
#if FAN_OFF_PWM > 0
|
||||||
|
#define FAN_MIN_PWM (FAN_OFF_PWM + 1)
|
||||||
|
#else
|
||||||
|
#define FAN_MIN_PWM 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifndef FAN_MAX_PWM
|
||||||
|
#define FAN_MAX_PWM 255
|
||||||
|
#endif
|
||||||
|
#if FAN_MIN_PWM == 0 && FAN_MAX_PWM == 255
|
||||||
|
#define CALC_FAN_SPEED(f) (f ?: FAN_OFF_PWM)
|
||||||
|
#else
|
||||||
|
#define CALC_FAN_SPEED(f) (f ? map(f, 1, 255, FAN_MIN_PWM, FAN_MAX_PWM) : FAN_OFF_PWM)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Fan Kickstart
|
||||||
|
#if FAN_KICKSTART_TIME && !defined(FAN_KICKSTART_POWER)
|
||||||
|
#define FAN_KICKSTART_POWER 180
|
||||||
|
#endif
|
||||||
|
|
||||||
// Servos
|
// Servos
|
||||||
#if PIN_EXISTS(SERVO0) && NUM_SERVOS > 0
|
#if PIN_EXISTS(SERVO0) && NUM_SERVOS > 0
|
||||||
#define HAS_SERVO_0 1
|
#define HAS_SERVO_0 1
|
||||||
|
|
|
@ -1560,11 +1560,11 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS
|
||||||
/**
|
/**
|
||||||
* Part-Cooling Fan Multiplexer requirements
|
* Part-Cooling Fan Multiplexer requirements
|
||||||
*/
|
*/
|
||||||
#if PIN_EXISTS(FANMUX1)
|
#if HAS_FANMUX && !HAS_FAN0
|
||||||
#if !HAS_FANMUX
|
#error "FAN0_PIN must be defined to use Fan Multiplexing."
|
||||||
#error "FANMUX0_PIN must be set before FANMUX1_PIN can be set."
|
#elif PIN_EXISTS(FANMUX1) && !PIN_EXISTS(FANMUX0)
|
||||||
#endif
|
#error "FANMUX0_PIN must be set before FANMUX1_PIN can be set."
|
||||||
#elif PIN_EXISTS(FANMUX2)
|
#elif PIN_EXISTS(FANMUX2) && !PINS_EXIST(FANMUX0, FANMUX1)
|
||||||
#error "FANMUX0_PIN and FANMUX1_PIN must be set before FANMUX2_PIN can be set."
|
#error "FANMUX0_PIN and FANMUX1_PIN must be set before FANMUX2_PIN can be set."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1608,7 +1608,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(MPC_INCLUDE_FAN)
|
#if ENABLED(MPC_INCLUDE_FAN)
|
||||||
#if FAN_COUNT < 1
|
#if !HAS_FAN
|
||||||
#error "MPC_INCLUDE_FAN requires at least one fan."
|
#error "MPC_INCLUDE_FAN requires at least one fan."
|
||||||
#endif
|
#endif
|
||||||
#if FAN_COUNT < HOTENDS
|
#if FAN_COUNT < HOTENDS
|
||||||
|
@ -1627,8 +1627,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS
|
||||||
#error "To use BED_LIMIT_SWITCHING you must disable PIDTEMPBED."
|
#error "To use BED_LIMIT_SWITCHING you must disable PIDTEMPBED."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fan Kickstart
|
// Fan Kickstart power
|
||||||
#if FAN_KICKSTART_TIME && defined(FAN_KICKSTART_POWER) && !WITHIN(FAN_KICKSTART_POWER, 64, 255)
|
#if FAN_KICKSTART_TIME && !WITHIN(FAN_KICKSTART_POWER, 64, 255)
|
||||||
#error "FAN_KICKSTART_POWER must be an integer from 64 to 255."
|
#error "FAN_KICKSTART_POWER must be an integer from 64 to 255."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2454,6 +2454,21 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure FAN_*_PWM values are sensible
|
||||||
|
*/
|
||||||
|
#if EITHER(HAS_FAN, USE_CONTROLLER_FAN)
|
||||||
|
#if !WITHIN(FAN_MIN_PWM, 0, 255)
|
||||||
|
#error "FAN_MIN_PWM must be a value from 0 to 255."
|
||||||
|
#elif !WITHIN(FAN_MAX_PWM, 0, 255)
|
||||||
|
#error "FAN_MAX_PWM must be a value from 0 to 255."
|
||||||
|
#elif FAN_MIN_PWM > FAN_MAX_PWM
|
||||||
|
#error "FAN_MIN_PWM must be less than or equal to FAN_MAX_PWM."
|
||||||
|
#elif FAN_OFF_PWM > FAN_MIN_PWM
|
||||||
|
#error "FAN_OFF_PWM must be less than or equal to FAN_MIN_PWM."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef REDUNDANT_PART_COOLING_FAN
|
#ifdef REDUNDANT_PART_COOLING_FAN
|
||||||
#if FAN_COUNT < 2
|
#if FAN_COUNT < 2
|
||||||
#error "REDUNDANT_PART_COOLING_FAN requires a board with at least two PWM fans."
|
#error "REDUNDANT_PART_COOLING_FAN requires a board with at least two PWM fans."
|
||||||
|
|
Loading…
Reference in a new issue