diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-04-20 21:50:32 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-04-20 22:16:08 -0400 |
commit | 8f4f5da11c1a6a1a80e4b02c9775b9154cb688a2 (patch) | |
tree | d48a7446d0cb864690ceacd88df79cdd26c3eb0f /klippy | |
parent | 6d03dee104531cc174b8ed8a0886768956bade31 (diff) | |
download | kutter-8f4f5da11c1a6a1a80e4b02c9775b9154cb688a2.tar.gz kutter-8f4f5da11c1a6a1a80e4b02c9775b9154cb688a2.tar.xz kutter-8f4f5da11c1a6a1a80e4b02c9775b9154cb688a2.zip |
fan: Add a set_shutdown_speed() method
Add a set_shutdown_speed() method so that the heater_fan code does not
need to peek into the fan object's internal members.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/extras/fan.py | 2 | ||||
-rw-r--r-- | klippy/extras/heater_fan.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/klippy/extras/fan.py b/klippy/extras/fan.py index d59d777f..cbd0d464 100644 --- a/klippy/extras/fan.py +++ b/klippy/extras/fan.py @@ -18,6 +18,8 @@ class PrinterFan: cycle_time = config.getfloat('cycle_time', 0.010, above=0.) hardware_pwm = config.getboolean('hardware_pwm', False) self.mcu_fan.setup_cycle_time(cycle_time, hardware_pwm) + def set_shutdown_speed(self, speed): + self.mcu_fan.setup_start_value(0., max(0., min(self.max_power, speed))) def set_speed(self, print_time, value): value = max(0., min(self.max_power, value * self.max_power)) if value == self.last_fan_value: diff --git a/klippy/extras/heater_fan.py b/klippy/extras/heater_fan.py index 7cbcfc2a..a8bf3cbd 100644 --- a/klippy/extras/heater_fan.py +++ b/klippy/extras/heater_fan.py @@ -15,7 +15,7 @@ class PrinterHeaterFan: self.fan = fan.PrinterFan(config) self.mcu = self.fan.mcu_fan.get_mcu() self.fan_speed = config.getfloat("fan_speed", 1., minval=0., maxval=1.) - self.fan.mcu_fan.setup_start_value(0., self.fan.max_power) + self.fan.set_shutdown_speed(1.) def printer_state(self, state): if state == 'ready': pheater = self.printer.lookup_object('heater') |