Skip to content

Commit

Permalink
removed controlled_fan, deprecated setting
Browse files Browse the repository at this point in the history
  • Loading branch information
NokkOnEffect committed Dec 11, 2024
1 parent cc34fa5 commit b1617ec
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions klippy/extras/temperature_fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(
Expand Down Expand Up @@ -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()
Expand All @@ -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]
)
Expand All @@ -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)

0 comments on commit b1617ec

Please sign in to comment.