-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disable heaters if a specified mcu is connected #425
base: main
Are you sure you want to change the base?
Changes from 8 commits
109c050
06b09e0
5b1a995
22b2e0b
34d6fd3
1a18466
3c4d97c
2551506
d5f0da8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1091,7 +1091,9 @@ per_move_pressure_advance: False | |
# If true, uses pressure advance constant from trapq when processing moves | ||
# This causes changes to pressure advance be taken into account immediately, | ||
# for all moves in the current queue, rather than ~250ms later once the queue gets flushed | ||
#disable_if_connected: | ||
# List of mcus that should disable the heater if connected, usefull for nozzle adxls | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo in useful There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whoops |
||
# as to not accidentally fry them due to heating the hotend. | ||
``` | ||
|
||
### [heater_bed] | ||
|
@@ -1107,6 +1109,7 @@ sensor_pin: | |
control: | ||
min_temp: | ||
max_temp: | ||
disable_if_connected: | ||
# See the "extruder" section for a description of the above parameters. | ||
``` | ||
|
||
|
@@ -2920,6 +2923,7 @@ target temperature. | |
#pwm_cycle_time: | ||
#min_temp: | ||
#max_temp: | ||
#disable_if_connected: | ||
# See the "extruder" section for the definition of the above | ||
# parameters. | ||
``` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,11 @@ def __init__(self, config, sensor): | |
self.printer.get_start_args().get("debugoutput") is not None | ||
) | ||
self.can_extrude = self.min_extrude_temp <= 0.0 or is_fileoutput | ||
self.disable_if_connected = [] | ||
if hasattr(config, "getlist"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the hasattr()? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cause some dummy configs don't have that attribute and I ran into issues without it in the older version |
||
self.disable_if_connected = config.getlist( | ||
"disable_if_connected", self.disable_if_connected | ||
) | ||
self.max_power = config.getfloat( | ||
"max_power", 1.0, above=0.0, maxval=1.0 | ||
) | ||
|
@@ -130,6 +135,12 @@ def __init__(self, config, sensor): | |
"klippy:shutdown", self._handle_shutdown | ||
) | ||
|
||
def notify_disabled(self, mcu_name): | ||
raise self.printer.command_error( | ||
"Heater [%s] is disabled due to [%s] being connected." | ||
% (self.short_name, mcu_name) | ||
) | ||
|
||
def lookup_control(self, profile, load_clean=False): | ||
algos = collections.OrderedDict( | ||
{ | ||
|
@@ -1102,6 +1113,16 @@ def check(eventtime): | |
self.printer.wait_while(check) | ||
|
||
def set_temperature(self, heater, temp, wait=False): | ||
for mcu_name in heater.disable_if_connected: | ||
if not mcu_name.startswith("mcu"): | ||
mcu_name = "mcu " + mcu_name | ||
mcu_object = self.printer.lookup_object(mcu_name, None) | ||
if ( | ||
mcu_object is not None | ||
and not mcu_object.non_critical_disconnected | ||
): | ||
heater.notify_disabled(mcu_name) | ||
return | ||
toolhead = self.printer.lookup_object("toolhead") | ||
toolhead.register_lookahead_callback((lambda pt: None)) | ||
heater.set_temp(temp) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the message needs improving