aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-05-20 12:52:19 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-05-20 12:52:19 -0400
commit2ab47cd20c87aa6798f13e0f5180cb90c9cba614 (patch)
tree433374572e84ab2e6a0901a22b25f557fefa3cec /klippy
parent75a1e9ea21c305c50c1ffe6eb93c42106ff16f3e (diff)
downloadkutter-2ab47cd20c87aa6798f13e0f5180cb90c9cba614.tar.gz
kutter-2ab47cd20c87aa6798f13e0f5180cb90c9cba614.tar.xz
kutter-2ab47cd20c87aa6798f13e0f5180cb90c9cba614.zip
extruder: Fix SET_PRESSURE_ADVANCE so that it works with multiple extruders
Use the new gcode.register_mux_command() so that SET_PRESSURE_ADVANCE works correctly with multiple extruders. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/extruder.py14
-rw-r--r--klippy/toolhead.py2
2 files changed, 13 insertions, 3 deletions
diff --git a/klippy/extruder.py b/klippy/extruder.py
index 3e4934e8..f80da6d6 100644
--- a/klippy/extruder.py
+++ b/klippy/extruder.py
@@ -46,9 +46,14 @@ class PrinterExtruder:
'pressure_advance_lookahead_time', 0.010, minval=0.)
self.need_motor_enable = True
self.extrude_pos = 0.
- self.printer.lookup_object('gcode').register_command(
- "SET_PRESSURE_ADVANCE", self.cmd_SET_PRESSURE_ADVANCE,
- desc=self.cmd_SET_PRESSURE_ADVANCE_help)
+ gcode = self.printer.lookup_object('gcode')
+ if self.name in ('extruder', 'extruder0'):
+ gcode.register_mux_command("SET_PRESSURE_ADVANCE", "EXTRUDER", None,
+ self.cmd_default_SET_PRESSURE_ADVANCE,
+ desc=self.cmd_SET_PRESSURE_ADVANCE_help)
+ gcode.register_mux_command("SET_PRESSURE_ADVANCE", "EXTRUDER", self.name,
+ self.cmd_SET_PRESSURE_ADVANCE,
+ desc=self.cmd_SET_PRESSURE_ADVANCE_help)
def get_heater(self):
return self.heater
def set_active(self, print_time, is_active):
@@ -225,6 +230,9 @@ class PrinterExtruder:
start_pos -= retract_d
self.extrude_pos = start_pos
cmd_SET_PRESSURE_ADVANCE_help = "Set pressure advance parameters"
+ def cmd_default_SET_PRESSURE_ADVANCE(self, params):
+ extruder = self.printer.lookup_object('toolhead').get_extruder()
+ extruder.cmd_SET_PRESSURE_ADVANCE(params)
def cmd_SET_PRESSURE_ADVANCE(self, params):
self.printer.lookup_object('toolhead').get_last_move_time()
gcode = self.printer.lookup_object('gcode')
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index ff51c4c9..f62a86fe 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -372,6 +372,8 @@ class ToolHead:
self.extruder = extruder
self.move_queue.set_extruder(extruder)
self.commanded_pos[3] = extrude_pos
+ def get_extruder(self):
+ return self.extruder
# Misc commands
def stats(self, eventtime):
for m in self.all_mcus: