From b1617ec9a7a6bf1e3405ccfef48927e67ea0f22e Mon Sep 17 00:00:00 2001 From: NokkOnEffect Date: Wed, 11 Dec 2024 21:21:49 +0100 Subject: [PATCH] removed controlled_fan, deprecated setting --- klippy/extras/temperature_fan.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/klippy/extras/temperature_fan.py b/klippy/extras/temperature_fan.py index 4d849ae11..c6d503025 100644 --- a/klippy/extras/temperature_fan.py +++ b/klippy/extras/temperature_fan.py @@ -249,11 +249,8 @@ def get_type(self): class ControlCurve: - def __init__(self, temperature_fan, config, controlled_fan=None): + def __init__(self, temperature_fan, config): self.temperature_fan = temperature_fan - self.controlled_fan = ( - temperature_fan if controlled_fan is None else controlled_fan - ) points = list( config.getlists("points", seps=(",", "\n"), parser=float, count=2) @@ -267,7 +264,8 @@ def __init__(self, temperature_fan, config, controlled_fan=None): ) if any(len(point) != 2 for point in points): raise temperature_fan.printer.config_error( - "A point must have exactly one temperature and one pwm setting value." + "A point must have exactly one temperature and one pwm setting " + "value." ) if not all(points[i] <= points[i + 1] for i in range(len(points) - 1)): raise temperature_fan.printer.config_error( @@ -302,6 +300,12 @@ def __init__(self, temperature_fan, config, controlled_fan=None): if points[-1][0] < temperature_fan.max_temp: points.append((temperature_fan.max_temp, points[-1][1])) + self.smooth_readings = config.getint( + "smooth_readings", default=None, minval=0 + ) + if self.smooth_readings is not None: + config.deprecate("smooth_readings") + self.cooling_hysteresis = config.getfloat("cooling_hysteresis", 0.0) self.heating_hysteresis = config.getfloat("heating_hysteresis", 0.0) self.curve_standard = np.array([*points]).transpose() @@ -311,7 +315,7 @@ def __init__(self, temperature_fan, config, controlled_fan=None): self.curve_cooling[0, :] -= self.cooling_hysteresis def temperature_callback(self, read_time, temp): - current_speed = self.controlled_fan.last_speed_value + current_speed = self.temperature_fan.last_speed_value upper_temp = np.interp( current_speed, self.curve_heating[1], self.curve_heating[0] ) @@ -330,11 +334,11 @@ def temperature_callback(self, read_time, temp): else: next_speed = current_speed - self.controlled_fan.set_speed(read_time, next_speed) + self.temperature_fan.set_speed(read_time, next_speed) def get_type(self): return "curve" def load_config_prefix(config): - return TemperatureFan(config) + return TemperatureFan(config) \ No newline at end of file