-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
heater_fan: log a warning if pin is non among initial pins
This will poke a user towards configuring it as a safety measure, i.e. cooling the heater if a restart fails. Example output: `Heater fan's pin '!PA1' is not among initial pins of MCU 'toolhead'. Consider adding it for safety.` Signed-off-by: Kamil Domański <[email protected]>
- Loading branch information
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
# Copyright (C) 2016-2020 Kevin O'Connor <[email protected]> | ||
# | ||
# This file may be distributed under the terms of the GNU GPLv3 license. | ||
import logging | ||
from . import fan | ||
|
||
PIN_MIN_TIME = 0.100 | ||
|
@@ -19,6 +20,11 @@ def __init__(self, config): | |
self.fan_speed = config.getfloat("fan_speed", 1., minval=0., maxval=1.) | ||
self.last_speed = 0. | ||
def handle_ready(self): | ||
if not self.fan.mcu_fan.is_initial_pin(): | ||
logging.warning( | ||
"Heater fan's pin '%s' is not among initial pins of MCU '%s'. " | ||
"Consider adding it for safety." | ||
% (self.fan.mcu_fan.raw_pin_string(), self.fan.get_mcu()._name)) | ||
pheaters = self.printer.lookup_object('heaters') | ||
self.heaters = [pheaters.lookup_heater(n) for n in self.heater_names] | ||
reactor = self.printer.get_reactor() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters