aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--docs/G-Codes.md5
-rw-r--r--klippy/extruder.py14
-rw-r--r--klippy/toolhead.py2
3 files changed, 16 insertions, 5 deletions
diff --git a/docs/G-Codes.md b/docs/G-Codes.md
index 429dff74..aa795205 100644
--- a/docs/G-Codes.md
+++ b/docs/G-Codes.md
@@ -84,9 +84,10 @@ The following standard commands are supported:
[ACCEL_TO_DECEL=<value>] [JUNCTION_DEVIATION=<value>]`: Modify the
printer's velocity limits. Note that one may only set values less
than or equal to the limits specified in the config file.
-- `SET_PRESSURE_ADVANCE [ADVANCE=<pressure_advance>]
+- `SET_PRESSURE_ADVANCE [EXTRUDER=<config_name>] [ADVANCE=<pressure_advance>]
[ADVANCE_LOOKAHEAD_TIME=<pressure_advance_lookahead_time>]`:
- Set pressure advance parameters.
+ Set pressure advance parameters. If EXTRUDER is not specified, it
+ defaults to the active extruder.
- `RESTART`: This will cause the host software to reload its config
and perform an internal reset. This command will not clear error
state from the micro-controller (see FIRMWARE_RESTART) nor will it
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: