Skip to content

Commit cf43df3

Browse files
committed
misc. cleanup
1 parent faa6ad2 commit cf43df3

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

Marlin/Configuration_adv.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,8 @@
604604
*/
605605
//#define FAN_KICKSTART_TIME 100 // (ms)
606606
//#define FAN_KICKSTART_POWER 180 // 64-255
607-
//#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.
608-
// Usefull for quick speed up to low speed. Kickstart power will be set to 255.
607+
//#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.
608+
// Useful for quick speed up to low speed. Kickstart power must be set to 255.
609609

610610
// Some coolers may require a non-zero "off" state.
611611
//#define FAN_OFF_PWM 1

Marlin/src/inc/Conditionals_post.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2752,7 +2752,7 @@
27522752

27532753
// Fan Kickstart
27542754
#if FAN_KICKSTART_TIME && !defined(FAN_KICKSTART_POWER)
2755-
#define FAN_KICKSTART_POWER 180
2755+
#define FAN_KICKSTART_POWER TERN(FAN_KICKSTART_LINEAR, 255, 180)
27562756
#endif
27572757

27582758
// Servos

Marlin/src/inc/SanityCheck.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -1011,8 +1011,12 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
10111011
#endif
10121012

10131013
// Fan Kickstart power
1014-
#if FAN_KICKSTART_TIME && !WITHIN(FAN_KICKSTART_POWER, 64, 255)
1015-
#error "FAN_KICKSTART_POWER must be an integer from 64 to 255."
1014+
#if FAN_KICKSTART_TIME
1015+
#if ENABLED(FAN_KICKSTART_LINEAR) && FAN_KICKSTART_POWER != 255
1016+
#error "FAN_KICKSTART_LINEAR requires a FAN_KICKSTART_POWER of 255."
1017+
#elif !WITHIN(FAN_KICKSTART_POWER, 64, 255)
1018+
#error "FAN_KICKSTART_POWER must be an integer from 64 to 255."
1019+
#endif
10161020
#endif
10171021

10181022
/**

Marlin/src/module/planner.cpp

+8-11
Original file line numberDiff line numberDiff line change
@@ -1314,19 +1314,16 @@ void Planner::recalculate(const_float_t safe_exit_speed_sqr) {
13141314
if (fan_speed[f] > FAN_OFF_PWM) {
13151315
if (fan_kick_end[f] == 0 && fan_speed[f] > set_fan_speed[f]) {
13161316
fan_kick_end[f] = ms + FAN_KICKSTART_TIME TERN_(FAN_KICKSTART_LINEAR, * (fan_speed[f] - set_fan_speed[f]) / 255);
1317-
fan_speed[f] = TERN(FAN_KICKSTART_LINEAR, 255, FAN_KICKSTART_POWER);
1317+
fan_speed[f] = FAN_KICKSTART_POWER;
1318+
return;
1319+
}
1320+
else if (PENDING(ms, fan_kick_end[f])) {
1321+
fan_speed[f] = FAN_KICKSTART_POWER;
1322+
return;
13181323
}
1319-
else if (PENDING(ms, fan_kick_end[f]))
1320-
fan_speed[f] = TERN(FAN_KICKSTART_LINEAR, 255, FAN_KICKSTART_POWER);
1321-
else {
1322-
fan_kick_end[f] = 0;
1323-
set_fan_speed[f] = fan_speed[f];
1324-
}
1325-
}
1326-
else {
1327-
fan_kick_end[f] = 0;
1328-
set_fan_speed[f] = fan_speed[f];
13291324
}
1325+
fan_kick_end[f] = 0;
1326+
set_fan_speed[f] = fan_speed[f];
13301327
}
13311328

13321329
#endif

0 commit comments

Comments
 (0)