fan: Enable heater_fan objects on an MCU shutdown event
Should the MCU go into an error state, set the heater_fan to max_power. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
3c4d14bfa9
commit
3506d1e994
|
@ -29,7 +29,8 @@
|
|||
|
||||
# Heater cooling fans (one may define any number of sections with a
|
||||
# "heater_fan" prefix). A "heater fan" is a fan that will be enabled
|
||||
# whenever its associated heater is active.
|
||||
# whenever its associated heater is active. In the event of an MCU
|
||||
# software error the heater_fan will be set to its max_power.
|
||||
#[heater_fan my_nozzle_fan]
|
||||
# See the "fan" section for fan configuration parameters.
|
||||
#pin: ar4
|
||||
|
@ -40,6 +41,10 @@
|
|||
#heater_temp: 50.0
|
||||
# A temperature (in Celsius) that the heater must drop below before
|
||||
# the fan is disabled. The default is 50 Celsius.
|
||||
#fan_speed:
|
||||
# The fan speed (expressed as a value from 0.0 to 1.0) that the fan
|
||||
# will be set to when its associated heater is enabled. The default
|
||||
# is max_power.
|
||||
|
||||
|
||||
# Additional micro-controllers (one may define any number of sections
|
||||
|
|
|
@ -39,6 +39,10 @@ class PrinterHeaterFan:
|
|||
heater = config.get("heater", "extruder0")
|
||||
self.heater = extruder.get_printer_heater(printer, heater)
|
||||
self.heater_temp = config.getfloat("heater_temp", 50.0)
|
||||
max_power = self.fan.max_power
|
||||
self.fan_speed = config.getfloat(
|
||||
"fan_speed", max_power, minval=0., maxval=max_power)
|
||||
self.fan.mcu_fan.setup_shutdown_value(max_power)
|
||||
printer.reactor.register_timer(self.callback, printer.reactor.NOW)
|
||||
def callback(self, eventtime):
|
||||
current_temp, target_temp = self.heater.get_temp(eventtime)
|
||||
|
@ -47,7 +51,7 @@ class PrinterHeaterFan:
|
|||
return eventtime + 1.
|
||||
power = 0.
|
||||
if target_temp or current_temp > self.heater_temp:
|
||||
power = 1.
|
||||
power = self.fan_speed
|
||||
print_time = self.mcu.estimated_print_time(eventtime) + FAN_MIN_TIME
|
||||
self.fan.set_speed(print_time, power)
|
||||
return eventtime + 1.
|
||||
|
|
Loading…
Reference in New Issue