From 29575e1e3724e950f2dabbde6d683a102f127f95 Mon Sep 17 00:00:00 2001 From: Zeanon Date: Fri, 20 Oct 2023 14:46:18 +0200 Subject: [PATCH] . --- klippy/extras/controller_fan.py | 7 ++++--- klippy/extras/heater_fan.py | 7 ++++--- klippy/extras/temperature_fan.py | 13 +++++++------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/klippy/extras/controller_fan.py b/klippy/extras/controller_fan.py index c4c19118dac2..4d4dbe004081 100644 --- a/klippy/extras/controller_fan.py +++ b/klippy/extras/controller_fan.py @@ -90,9 +90,10 @@ def callback(self, eventtime): cmd_SET_CONTROLLER_FAN_help = "Enable or Disable a heater_fan" def cmd_SET_CONTROLLER_FAN(self, gcmd): self.enabled = gcmd.get_int('ENABLE', self.enabled, minval=0, maxval=1) - curtime = self.printer.get_reactor().monotonic() - print_time = self.fan.get_mcu().estimated_print_time(curtime) - self.fan.set_speed(print_time + PIN_MIN_TIME, 0.0) + if not self.enabled: + curtime = self.printer.get_reactor().monotonic() + print_time = self.fan.get_mcu().estimated_print_time(curtime) + self.fan.set_speed(print_time + PIN_MIN_TIME, 0.0) def load_config_prefix(config): return ControllerFan(config) diff --git a/klippy/extras/heater_fan.py b/klippy/extras/heater_fan.py index ebcd0ba49295..ff25c68a2257 100644 --- a/klippy/extras/heater_fan.py +++ b/klippy/extras/heater_fan.py @@ -54,9 +54,10 @@ def callback(self, eventtime): cmd_SET_HEATER_FAN_help = "Enable or Disable a heater_fan" def cmd_SET_HEATER_FAN(self, gcmd): self.enabled = gcmd.get_int('ENABLE', self.enabled, minval=0, maxval=1) - curtime = self.printer.get_reactor().monotonic() - print_time = self.fan.get_mcu().estimated_print_time(curtime) - self.fan.set_speed(print_time + PIN_MIN_TIME, 0.0) + if not self.enabled: + curtime = self.printer.get_reactor().monotonic() + print_time = self.fan.get_mcu().estimated_print_time(curtime) + self.fan.set_speed(print_time + PIN_MIN_TIME, 0.0) def load_config_prefix(config): return PrinterHeaterFan(config) diff --git a/klippy/extras/temperature_fan.py b/klippy/extras/temperature_fan.py index 61480d7ae3a8..e6d92d1eba84 100644 --- a/klippy/extras/temperature_fan.py +++ b/klippy/extras/temperature_fan.py @@ -93,10 +93,9 @@ def get_status(self, eventtime): cmd_SET_TEMPERATURE_FAN_TARGET_help = \ "Sets a temperature fan target and fan speed limits" def cmd_SET_TEMPERATURE_FAN_TARGET(self, gcmd): - if self.control.get_type() == 'curve': + target = gcmd.get_float('TARGET', None) + if target is not None and self.control.get_type() == 'curve': raise gcmd.error("Setting Target not supported for control curve") - temp = gcmd.get_float('TARGET', self.target_temp_conf) - self.set_temp(temp) min_speed = gcmd.get_float('MIN_SPEED', self.min_speed) max_speed = gcmd.get_float('MAX_SPEED', self.max_speed) if min_speed > max_speed: @@ -105,6 +104,7 @@ def cmd_SET_TEMPERATURE_FAN_TARGET(self, gcmd): % (min_speed, max_speed)) self.set_min_speed(min_speed) self.set_max_speed(max_speed) + self.set_temp(self.target_temp_conf if target is None else target) cmd_SET_TEMPERATURE_FAN_help = "Enable or Disable a heater_fan" def cmd_SET_TEMPERATURE_FAN(self, gcmd): target = gcmd.get_float('TARGET', None) @@ -120,9 +120,10 @@ def cmd_SET_TEMPERATURE_FAN(self, gcmd): self.set_min_speed(min_speed) self.set_max_speed(max_speed) self.set_temp(self.target_temp_conf if target is None else target) - curtime = self.printer.get_reactor().monotonic() - print_time = self.fan.get_mcu().estimated_print_time(curtime) - self.fan.set_speed(print_time, 0.0) + if not self.enabled: + curtime = self.printer.get_reactor().monotonic() + print_time = self.fan.get_mcu().estimated_print_time(curtime) + self.fan.set_speed(print_time, 0.0) def set_temp(self, degrees): if degrees and (degrees < self.min_temp or degrees > self.max_temp):