⚡️ Reduce calls to set fan PWM (#23149)
This commit is contained in:
parent
2cc4a1b326
commit
281ed99868
|
@ -1311,7 +1311,8 @@ void Planner::check_axes_activity() {
|
|||
#endif
|
||||
|
||||
#if HAS_TAIL_FAN_SPEED
|
||||
uint8_t tail_fan_speed[FAN_COUNT];
|
||||
static uint8_t tail_fan_speed[FAN_COUNT];
|
||||
bool fans_need_update = false;
|
||||
#endif
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
|
@ -1330,7 +1331,13 @@ void Planner::check_axes_activity() {
|
|||
#endif
|
||||
|
||||
#if HAS_TAIL_FAN_SPEED
|
||||
FANS_LOOP(i) tail_fan_speed[i] = thermalManager.scaledFanSpeed(i, block->fan_speed[i]);
|
||||
FANS_LOOP(i) {
|
||||
const uint8_t spd = thermalManager.scaledFanSpeed(i, block->fan_speed[i]);
|
||||
if (tail_fan_speed[i] != spd) {
|
||||
fans_need_update = true;
|
||||
tail_fan_speed[i] = spd;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
|
@ -1358,7 +1365,13 @@ void Planner::check_axes_activity() {
|
|||
TERN_(HAS_CUTTER, cutter.refresh());
|
||||
|
||||
#if HAS_TAIL_FAN_SPEED
|
||||
FANS_LOOP(i) tail_fan_speed[i] = thermalManager.scaledFanSpeed(i);
|
||||
FANS_LOOP(i) {
|
||||
const uint8_t spd = thermalManager.scaledFanSpeed(i);
|
||||
if (tail_fan_speed[i] != spd) {
|
||||
fans_need_update = true;
|
||||
tail_fan_speed[i] = spd;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
|
@ -1384,7 +1397,7 @@ void Planner::check_axes_activity() {
|
|||
// Update Fan speeds
|
||||
// Only if synchronous M106/M107 is disabled
|
||||
//
|
||||
TERN_(HAS_TAIL_FAN_SPEED, sync_fan_speeds(tail_fan_speed));
|
||||
TERN_(HAS_TAIL_FAN_SPEED, if (fans_need_update) sync_fan_speeds(tail_fan_speed));
|
||||
|
||||
TERN_(AUTOTEMP, autotemp_task());
|
||||
|
||||
|
|
Loading…
Reference in a new issue