Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into servo_template
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeanon committed Sep 29, 2023
2 parents fe455cd + 13cb693 commit ad076b2
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 9 deletions.
29 changes: 29 additions & 0 deletions docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2917,6 +2917,8 @@ sections with a "temperature_fan" prefix). A "temperature fan" is a
fan that will be enabled whenever its associated sensor is above a set
temperature. By default, a temperature_fan has a shutdown_speed equal
to max_power.
While not being able to use "pid_v" as a control, a temperature_fan can use "curve"
for control.

See the [command reference](G-Codes.md#temperature_fan) for additional
information.
Expand Down Expand Up @@ -2978,7 +2980,34 @@ reverse: False
# The default is False
```

```
control: curve
#point1: 50.0, 0.0
#point2: 55.0, 0.5
# A user might defne up to 99 points which consist of a temperature with
# it's associated fan speed (temp, fan_speed).
# The target_temp value defines the temperature at which the fan will run
# at full speed.
# The algorithm will use linear interpolation to get the fan speeds
# between two points (if one has defined 0.0 for 50° and 1.0 for 60° the
# fan would run with 0.5 at 55°)
#cooling_hysteresis: 0.0
# define the temperature hysteresis for lowering the fan speed
# (temperature differences to the last measured value that are lower than
# the hysteresis will not cause lowering of the fan speed)
#heating_hysteresis: 0.0
# same as cooling_hysteresis but for increasing the fan speed, it is
# recommended to be left at 0 for safety reasons
#smooth_readings: 10
# the amount of readings a median should be taken of to determine the fan
# speed at each update interval, the default is 10
```

### [controller_temperature_fan]
A combination of a controller and a temperature_fan, takes values of both and
applies the higher speed of both implementations at any given time.
Most useful for electronics bays to control the fans via controllers and mcu
temperature.

### [fan_generic]

Expand Down
5 changes: 3 additions & 2 deletions docs/Sponsors.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sponsors.

## BIGTREETECH

[<img src="./img/sponsors/BTT_BTT.png" width="200" />](https://bigtree-tech.com/collections/all-products)
[<img src="./img/sponsors/BTT_BTT.png" width="200" style="margin:25px"/>](https://bigtree-tech.com/collections/all-products)

BIGTREETECH is the official mainboard sponsor of Klipper. BIGTREETECH
is committed to developing innovative and competitive products to
Expand All @@ -16,7 +16,8 @@ serve the 3D printing community better. Follow them on

## Sponsors

[<img src="./img/sponsors/obico-light-horizontal.png" width="200" />](https://obico.io/klipper.html?source=klipper_sponsor)
[<img src="./img/sponsors/obico-light-horizontal.png" width="200" style="margin:25px" />](https://obico.io/klipper.html?source=klipper_sponsor)
[<img src="./img/sponsors/peopoly-logo.png" width="200" style="margin:25px" />](https://peopoly.net)

## Klipper Developers

Expand Down
Binary file added docs/img/sponsors/peopoly-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion klippy/extras/controller_temperature_fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def __init__(self, config):
self)
self.controller_fan = controller_fan.ControllerFan(config, self.fan)
def set_speed(self, read_time, value):
value = max(value, self.controller_fan.get_speed(read_time))
self.temperature_fan.set_speed(read_time,
max(value,
self
Expand Down
17 changes: 11 additions & 6 deletions klippy/extras/temperature_fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def __init__(self, temperature_fan, config, controlled_fan=None):
for i in range(1, 99):
current_point = config.getfloatlist('point%d' % i, None)
if current_point is None:
break
continue
if len(current_point) != 2:
raise temperature_fan.printer.config_error(
"Point needs to have exactly one temperature and one speed "
Expand Down Expand Up @@ -253,7 +253,8 @@ def __init__(self, temperature_fan, config, controlled_fan=None):
"equal speed than points with lower temperatures."
)
last_point = point
self.hysteresis = config.getfloat('hysteresis', 0.0)
self.cooling_hysteresis = config.getfloat('cooling_hysteresis', 0.0)
self.heating_hysteresis = config.getfloat('heating_hysteresis', 0.0)
self.smooth_readings = config.getint('smooth_readings', 10, minval=1)
self.stored_temps = []
for i in range(self.smooth_readings):
Expand All @@ -262,7 +263,7 @@ def __init__(self, temperature_fan, config, controlled_fan=None):
def temperature_callback(self, read_time, temp):
current_temp, target_temp = self.temperature_fan.get_temp(read_time)
temp = self.smooth_temps(temp)
if temp > target_temp:
if temp >= target_temp:
self.temperature_fan.set_speed(read_time,
self.temperature_fan.get_max_speed())
return
Expand All @@ -284,11 +285,15 @@ def interpolate(self, below, above, temp):
+ (above[1] * (temp - below[0])))
/ (above[0] - below[0]))
def smooth_temps(self, current_temp):
if self.last_temp - self.hysteresis < current_temp < self.last_temp:
temp = self.last_temp
if (self.last_temp - self.cooling_hysteresis
<=
current_temp
<=
self.last_temp + self.heating_hysteresis):
temp = self.last_temp
else:
temp = current_temp
self.last_temp = current_temp
self.last_temp = temp
for i in range(1, len(self.stored_temps)):
self.stored_temps[i] = self.stored_temps[i-1]
self.stored_temps[0] = temp
Expand Down

0 comments on commit ad076b2

Please sign in to comment.