controller_fan: Add fan_speed parameter.

This gives it parity with heater_fan.  Also change the default speed from
max_power to 1.0, since it is already scaled by max_power in set_speed.

Signed-off-by: Adrian Keet <arkeet@gmail.com>
This commit is contained in:
Adrian Keet 2020-05-17 13:26:51 -07:00 committed by KevinOConnor
parent 9530373ccb
commit b267178370
2 changed files with 9 additions and 8 deletions

View File

@ -1086,6 +1086,10 @@
#kick_start_time: #kick_start_time:
# See the "fan" section in example.cfg for a description of the # See the "fan" section in example.cfg for a description of the
# above parameters. # above parameters.
#fan_speed: 1.0
# The fan speed (expressed as a value from 0.0 to 1.0) that the fan
# will be set to when a heater or stepper driver is active.
# The default is 1.0
#idle_timeout: #idle_timeout:
# The ammount of time (in seconds) after a stepper driver or heater # The ammount of time (in seconds) after a stepper driver or heater
# was active and the fan should be kept running. The default # was active and the fan should be kept running. The default
@ -1093,8 +1097,7 @@
#idle_speed: #idle_speed:
# The fan speed (expressed as a value from 0.0 to 1.0) that the fan # The fan speed (expressed as a value from 0.0 to 1.0) that the fan
# will be set to when a heater or stepper driver was active and before # will be set to when a heater or stepper driver was active and before
# the idle_timeout is reached. This must be greater or equal # the idle_timeout is reached. The default is fan_speed.
# max_power. The default is max_power
#heater: #heater:
# Name of the config section defining the heater that this fan is # Name of the config section defining the heater that this fan is
# associated with. If a comma separated list of heater names is # associated with. If a comma separated list of heater names is

View File

@ -17,12 +17,10 @@ class ControllerFan:
self.heaters = [] self.heaters = []
self.fan = fan.PrinterFan(config) self.fan = fan.PrinterFan(config)
self.mcu = self.fan.mcu_fan.get_mcu() self.mcu = self.fan.mcu_fan.get_mcu()
self.max_power = config.getfloat( self.fan_speed = config.getfloat(
'max_power', default=1., 'fan_speed', default=1., minval=0., maxval=1.)
minval=0., maxval=1.)
self.idle_speed = config.getfloat( self.idle_speed = config.getfloat(
'idle_speed', default=self.max_power, 'idle_speed', default=self.fan_speed, minval=0., maxval=1.)
minval=0., maxval=self.max_power)
self.idle_timeout = config.getint("idle_timeout", default=30, minval=0) self.idle_timeout = config.getint("idle_timeout", default=30, minval=0)
self.heater_name = config.get("heater", "extruder") self.heater_name = config.get("heater", "extruder")
self.last_on = self.idle_timeout self.last_on = self.idle_timeout
@ -45,7 +43,7 @@ class ControllerFan:
active = True active = True
if active: if active:
self.last_on = 0 self.last_on = 0
power = self.max_power power = self.fan_speed
elif self.last_on < self.idle_timeout: elif self.last_on < self.idle_timeout:
power = self.idle_speed power = self.idle_speed
self.last_on += 1 self.last_on += 1