Added the ability to set heater_fan speed#729
Added the ability to set heater_fan speed#729TheAdeo wants to merge 1 commit intoKalicoCrew:mainfrom
Conversation
Now heater_fan accepts SET_FAN_SPEED, while still respecting the minimum speed dictated by the heater being on (or off) The heater being on or off automatically sets the minimum speed the fans needs to respect, while manual requests can only set the speed higher than that, or request a lower speed that will be set only when the heater turns off and the temp is below the one in the config.
| The following command is available when a | ||
| [fan_generic config section](Config_Reference.md#fan_generic) is | ||
| enabled. | ||
| [fan_generic](Config_Reference.md#fan_generic) |
There was a problem hiding this comment.
This probably needs to be reflowed?
There was a problem hiding this comment.
What do you mean by reflowed here? (apologies for the ignorance)
| current_temp, target_temp = heater.get_temp(eventtime) | ||
| if target_temp or current_temp > self.heater_temp: | ||
| speed = self.fan_speed | ||
| if (target_temp or current_temp > self.heater_temp) and self.enabled_fan_speed > speed: |
There was a problem hiding this comment.
The logic here is a bit hard to follow, could we split it over multiple statements or something? I'm having a hard time understanding the interaction between last_gcode_speed and enabled_fan_speed as the code currently stands.
There was a problem hiding this comment.
Hi, I'm going to follow up on this as I use this feature all the time and would love moonraker to not freak out about a dirty repo. Having just read through it, last_gcode_speed is always set to the value requested by the SET_FAN_SPEED command, and enabled_fan_speed is the constant speed defined in klipper config files.
In the callback function, the speed variable is now set to last_gcode_speed by default instead of 0. The AND statement in question now checks if the user-requested speed is less than the default enabled_fan_speed. If so, it is invalid, and speed will be overwritten by enabled_fan_speed. However if speed / last_gcode_speed is greater, then it is preserved and set as the fan speed.
Happy to split it up into multiple statements, but it would just be the same statement on the second line.
Now heater_fan accepts SET_FAN_SPEED, while still respecting the minimum speed dictated by the heater being on (or off)
The heater being on or off automatically sets the minimum speed the fans needs to respect, while manual requests can only set the speed higher than that, or request a lower speed that will be set only when the heater turns off and the temp is below the one in the config.
Checklist
I don't know if I have to add it to the readme myself, and I don't know that the "ci" is, but there are no conflicts