Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeanon committed Oct 20, 2023
1 parent 15f2420 commit 29575e1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
7 changes: 4 additions & 3 deletions klippy/extras/controller_fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
7 changes: 4 additions & 3 deletions klippy/extras/heater_fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
13 changes: 7 additions & 6 deletions klippy/extras/temperature_fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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):
Expand Down

0 comments on commit 29575e1

Please sign in to comment.