You nailed it. I’ve done a “limited” release of a patch of some fan fixes I put together, limited for now for major bug checks but soon I’ll release for everyone to try out if they want.
But the relevant portion of that “patch” is below and I think covers your concerns.
“Normalized” PWM Response
Per the Intel fan spec (which applies really to most fans not just PWM fans), PWM duty cycle below 20% is “undefined” and below 30% is frowned upon.
https://www.intel.com/content/dam/support/us/en/documents/intel-nuc/intel-4wire-pwm-fans-specs.pdf
4 wire PWM fans fix this in the fan circuitry, but normal brushless DC fans do not:
I’ve updated the “set_speed” to take this into account via a “scaling factor”.
It scales the commanded fan speed up where the new “0-100%” range is actually the old “25% - 100%” range.
This is transparent to the end user.
In other words, If the user uses the UI or GCode to command 40% fan speed the UI will show 40% fan speed.
But in the background it will actually be (.75 * .4) =.3 + .25 = 55% on the “old scale”
This does NOT apply if users are using a 4 Wire PWM fan (as defined by having “enable pin” defined). As those fans automatically do this and it skews their speed weirdly.
I found this change to work much better than I actually anticipated.
I think it better aligns with most users expectations of “If I say 40% I mean 40% of max RPM, not 40% duty cycle”.
Edit a few more:
Tachometer Failsafe/Warning
Added several new configuration options:
tach_loss_action: ('shutdown','warning','none'), default = 'shutdown'
tach_loss_interval: How many seconds before action is taken, default = 3
tach_warning_repeat_interval: Needs a better name, but is obvious. Default = loss interval
These are fairly self explanitory but if the tach signal is lost for over 3 seconds or the defined interval it either:
- Shuts down Klipper - This is the default and the ENFORCED action for heater fans
- Puts a warning on the GCode Console “Warning: “fan_name” has lost tach signal for longer than “tach_loss_interval” seconds!”
- Does nothing
The time frame is based on the “eventtime” of the get_status method/frequency counter call back so should be in real world seconds.
Temperature Fan Changes
Minimum Temp Cutoff
Added a new config option
min_temp_cutoff: default = 0, max_value = 65
This one is fairly obvious, added a .5% hysteresis around the cut off point to keep the fan from blipping on and off.
Also added a new parameter to the “set_speed” method to specify if the speed command is due to the temp cut off, this way it overrides the “min_speed” but still allows for both.
If this gets picked up I’ll make sure that’s in the config reference.
I know there are more improvements needed and there are a few more in this “test patch” but it moves towards a smarter/better fan IMO