aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/fan.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-09-12 12:47:40 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-09-19 17:25:42 -0400
commita100f174f98dc4294654da6f3145530fa05813c4 (patch)
tree5f46853022d8547d716dc6a54247c4acd3297d78 /klippy/fan.py
parent5dfe4e1eb977dada5ae29fa03fc0f17964d7c2dc (diff)
downloadkutter-a100f174f98dc4294654da6f3145530fa05813c4.tar.gz
kutter-a100f174f98dc4294654da6f3145530fa05813c4.tar.xz
kutter-a100f174f98dc4294654da6f3145530fa05813c4.zip
mcu: Pass print_time directly to MCU calls
Now that the print_time is always synchronized with the mcu_time, there is no longer a need to track mcu_time as a separate quantity. Eliminate references to mcu_time from the code and pass print_time directly in its place. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/fan.py')
-rw-r--r--klippy/fan.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/klippy/fan.py b/klippy/fan.py
index 8fa253bc..112fb34c 100644
--- a/klippy/fan.py
+++ b/klippy/fan.py
@@ -18,23 +18,19 @@ class PrinterFan:
self.mcu_fan.setup_max_duration(0.)
self.mcu_fan.setup_cycle_time(PWM_CYCLE_TIME)
self.mcu_fan.setup_hard_pwm(config.getint('hard_pwm', 0))
- def set_pwm(self, mcu_time, value):
+ def set_speed(self, print_time, value):
value = max(0., min(self.max_power, value))
if value == self.last_fan_value:
return
- mcu_time = max(self.last_fan_time + FAN_MIN_TIME, mcu_time)
+ print_time = max(self.last_fan_time + FAN_MIN_TIME, print_time)
if (value and value < self.max_power
and not self.last_fan_value and self.kick_start_time):
# Run fan at full speed for specified kick_start_time
- self.mcu_fan.set_pwm(mcu_time, self.max_power)
- mcu_time += self.kick_start_time
- self.mcu_fan.set_pwm(mcu_time, value)
- self.last_fan_time = mcu_time
+ self.mcu_fan.set_pwm(print_time, self.max_power)
+ print_time += self.kick_start_time
+ self.mcu_fan.set_pwm(print_time, value)
+ self.last_fan_time = print_time
self.last_fan_value = value
- # External commands
- def set_speed(self, print_time, value):
- mcu_time = self.mcu_fan.get_mcu().print_to_mcu_time(print_time)
- self.set_pwm(mcu_time, value)
class PrinterHeaterFan:
def __init__(self, printer, config):