✨ FAN_KICKSTART_LINEAR (#27072)
This commit is contained in:
parent
b303bb1e56
commit
10ffb9cb68
@ -604,6 +604,8 @@
|
|||||||
*/
|
*/
|
||||||
//#define FAN_KICKSTART_TIME 100 // (ms)
|
//#define FAN_KICKSTART_TIME 100 // (ms)
|
||||||
//#define FAN_KICKSTART_POWER 180 // 64-255
|
//#define FAN_KICKSTART_POWER 180 // 64-255
|
||||||
|
//#define FAN_KICKSTART_LINEAR // Set kickstart time linearly based on the speed, e.g., for 20% (51) it will be FAN_KICKSTART_TIME * 0.2.
|
||||||
|
// Useful for quick speed up to low speed. Kickstart power must be set to 255.
|
||||||
|
|
||||||
// Some coolers may require a non-zero "off" state.
|
// Some coolers may require a non-zero "off" state.
|
||||||
//#define FAN_OFF_PWM 1
|
//#define FAN_OFF_PWM 1
|
||||||
|
@ -2757,7 +2757,7 @@
|
|||||||
|
|
||||||
// Fan Kickstart
|
// Fan Kickstart
|
||||||
#if FAN_KICKSTART_TIME && !defined(FAN_KICKSTART_POWER)
|
#if FAN_KICKSTART_TIME && !defined(FAN_KICKSTART_POWER)
|
||||||
#define FAN_KICKSTART_POWER 180
|
#define FAN_KICKSTART_POWER TERN(FAN_KICKSTART_LINEAR, 255, 180)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Servos
|
// Servos
|
||||||
|
@ -1009,9 +1009,13 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fan Kickstart power
|
// Fan Kickstart power
|
||||||
#if FAN_KICKSTART_TIME && !WITHIN(FAN_KICKSTART_POWER, 64, 255)
|
#if FAN_KICKSTART_TIME
|
||||||
|
#if ENABLED(FAN_KICKSTART_LINEAR) && FAN_KICKSTART_POWER != 255
|
||||||
|
#error "FAN_KICKSTART_LINEAR requires a FAN_KICKSTART_POWER of 255."
|
||||||
|
#elif !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
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronous M106/M107 checks
|
* Synchronous M106/M107 checks
|
||||||
|
@ -1201,16 +1201,20 @@ void Planner::recalculate(const_float_t safe_exit_speed_sqr) {
|
|||||||
|
|
||||||
void Planner::kickstart_fan(uint8_t (&fan_speed)[FAN_COUNT], const millis_t &ms, const uint8_t f) {
|
void Planner::kickstart_fan(uint8_t (&fan_speed)[FAN_COUNT], const millis_t &ms, const uint8_t f) {
|
||||||
static millis_t fan_kick_end[FAN_COUNT] = { 0 };
|
static millis_t fan_kick_end[FAN_COUNT] = { 0 };
|
||||||
|
#if ENABLED(FAN_KICKSTART_LINEAR)
|
||||||
|
static uint8_t set_fan_speed[FAN_COUNT] = { 0 };
|
||||||
|
#endif
|
||||||
if (fan_speed[f] > FAN_OFF_PWM) {
|
if (fan_speed[f] > FAN_OFF_PWM) {
|
||||||
if (fan_kick_end[f] == 0) {
|
const bool first_kick = fan_kick_end[f] == 0 && TERN1(FAN_KICKSTART_LINEAR, fan_speed[f] > set_fan_speed[f]);
|
||||||
fan_kick_end[f] = ms + FAN_KICKSTART_TIME;
|
if (first_kick)
|
||||||
|
fan_kick_end[f] = ms + (FAN_KICKSTART_TIME) TERN_(FAN_KICKSTART_LINEAR, * (fan_speed[f] - set_fan_speed[f]) / 255);
|
||||||
|
if (first_kick || PENDING(ms, fan_kick_end[f])) {
|
||||||
fan_speed[f] = FAN_KICKSTART_POWER;
|
fan_speed[f] = FAN_KICKSTART_POWER;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (PENDING(ms, fan_kick_end[f]))
|
|
||||||
fan_speed[f] = FAN_KICKSTART_POWER;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
fan_kick_end[f] = 0;
|
fan_kick_end[f] = 0;
|
||||||
|
TERN_(FAN_KICKSTART_LINEAR, set_fan_speed[f] = fan_speed[f]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user