1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 13:25:54 +00:00

Handle special case of speed = 0

This commit is contained in:
David Buezas 2024-07-07 22:52:13 +02:00
parent df9234a68b
commit bd607b0ed1
2 changed files with 4 additions and 2 deletions

View File

@ -1184,7 +1184,7 @@ void Planner::recalculate(const_float_t safe_exit_speed_sqr) {
void Planner::sync_fan_speeds(uint8_t (&fan_speed)[FAN_COUNT]) { void Planner::sync_fan_speeds(uint8_t (&fan_speed)[FAN_COUNT]) {
#if defined(FAN_MULTIPLIER) #if defined(FAN_MULTIPLIER)
#define _CALC_FAN_SPEED(f) CALC_FAN_SPEED(thermalManager.compute_multiplied_fan(f)) #define _CALC_FAN_SPEED(f) CALC_FAN_SPEED(thermalManager.compute_multiplied_fan(f))
#else #else
#define _CALC_FAN_SPEED(f) CALC_FAN_SPEED(f) #define _CALC_FAN_SPEED(f) CALC_FAN_SPEED(f)
#endif #endif

View File

@ -291,7 +291,9 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED);
} }
uint8_t Temperature::compute_multiplied_fan(uint8_t speed){ uint8_t Temperature::compute_multiplied_fan(uint8_t speed){
return constrain(speed * fan_multiplier, 1, 255); if (!speed) return 0;
float new_speed = speed * fan_multiplier;
return constrain(new_speed, 1, 255);
} }
float Temperature::get_fan_multiplier(){ float Temperature::get_fan_multiplier(){