Skip to content

Added the ability to set heater_fan speed#729

Open
TheAdeo wants to merge 1 commit intoKalicoCrew:mainfrom
TheAdeo:main
Open

Added the ability to set heater_fan speed#729
TheAdeo wants to merge 1 commit intoKalicoCrew:mainfrom
TheAdeo:main

Conversation

@TheAdeo
Copy link

@TheAdeo TheAdeo commented Aug 23, 2025

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

  • pr title makes sense
  • added a test case if possible (N/A)
  • if new feature, added to the readme
  • ci is happy and green

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

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably needs to be reflowed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants