diff --git a/config/example-generic-caretesian.cfg b/config/example-generic-caretesian.cfg index 2d6b3994e..7c8aa4a4b 100644 --- a/config/example-generic-caretesian.cfg +++ b/config/example-generic-caretesian.cfg @@ -7,36 +7,39 @@ # See docs/Config_Reference.md for a description of parameters. -[carriage x] +[carriage carriage_x] +axis: x position_endstop: 0 position_max: 300 homing_speed: 50 endstop_pin: ^PE5 -[carriage y] +[carriage carriage_y] +axis: y position_endstop: 0 position_max: 200 homing_speed: 50 endstop_pin: ^PJ1 -[extra_carriage y1] -primary_carriage: y +[extra_carriage carriage_y1] +primary_carriage: carriage_y endstop_pin: ^PB6 -[carriage z] +[carriage carriage_z] +axis: z position_endstop: 0.5 position_max: 100 endstop_pin: ^PD3 -[dual_carriage u] -primary_carriage: x +[dual_carriage carriage_u] +primary_carriage: carriage_x position_endstop: 300 position_max: 300 homing_speed: 50 endstop_pin: ^PE4 [stepper my_stepper_x] -carriages: x+y +carriages: carriage_x+carriage_y step_pin: PF0 dir_pin: PF1 enable_pin: !PD7 @@ -44,7 +47,7 @@ microsteps: 16 rotation_distance: 40 [stepper my_stepper_u] -carriages: u-y1 +carriages: carriage_u-carriage_y1 step_pin: PH1 dir_pin: PH0 enable_pin: !PA1 @@ -52,7 +55,7 @@ microsteps: 16 rotation_distance: 40 [stepper my_stepper_y0] -carriages: y +carriages: carriage_y step_pin: PF6 dir_pin: !PF7 enable_pin: !PF2 @@ -60,7 +63,7 @@ microsteps: 16 rotation_distance: 40 [stepper my_stepper_y1] -carriages: y1 +carriages: carriage_y1 step_pin: PE3 dir_pin: !PH6 enable_pin: !PG5 @@ -68,7 +71,7 @@ microsteps: 16 rotation_distance: 40 [stepper my_stepper_z0] -carriages: z +carriages: carriage_z step_pin: PL3 dir_pin: PL1 enable_pin: !PK0 @@ -76,7 +79,7 @@ microsteps: 16 rotation_distance: 8 [stepper my_stepper_z1] -carriages: z +carriages: carriage_z step_pin: PG1 dir_pin: PG0 enable_pin: !PH3 diff --git a/config/sample-corexyuv.cfg b/config/sample-corexyuv.cfg index 368b64647..e33d8681a 100644 --- a/config/sample-corexyuv.cfg +++ b/config/sample-corexyuv.cfg @@ -3,28 +3,30 @@ # See docs/Config_Reference.md for a description of parameters. -[carriage x] +[carriage carriage_x] +axis: x position_endstop: 0 position_max: 300 homing_speed: 50 endstop_pin: ^PE5 -[carriage y] +[carriage carriage_y] +axis: y position_endstop: 0 position_max: 200 homing_speed: 50 endstop_pin: ^PJ1 -[dual_carriage u] -primary_carriage: x +[dual_carriage carriage_u] +primary_carriage: carriage_x safe_distance: 70 position_endstop: 300 position_max: 300 homing_speed: 50 endstop_pin: ^PE4 -[dual_carriage v] -primary_carriage: y +[dual_carriage carriage_v] +primary_carriage: carriage_y safe_distance: 50 position_endstop: 200 position_max: 200 @@ -32,7 +34,7 @@ homing_speed: 50 endstop_pin: ^PD4 [stepper a] -carriages: x+y +carriages: carriage_x+carriage_y step_pin: PF0 dir_pin: PF1 enable_pin: !PD7 @@ -40,7 +42,7 @@ microsteps: 16 rotation_distance: 40 [stepper b] -carriages: u-v +carriages: carriage_u-carriage_v step_pin: PH1 dir_pin: PH0 enable_pin: !PA1 @@ -48,7 +50,7 @@ microsteps: 16 rotation_distance: 40 [stepper c] -carriages: x-y +carriages: carriage_x-carriage_y step_pin: PF6 dir_pin: !PF7 enable_pin: !PF2 @@ -56,7 +58,7 @@ microsteps: 16 rotation_distance: 40 [stepper d] -carriages: u+v +carriages: carriage_u+carriage_v step_pin: PE3 dir_pin: !PH6 enable_pin: !PG5 @@ -83,8 +85,8 @@ max_temp: 250 [gcode_macro PARK_extruder] gcode: - SET_DUAL_CARRIAGE CARRIAGE=x - SET_DUAL_CARRIAGE CARRIAGE=y + SET_DUAL_CARRIAGE CARRIAGE=carriage_x + SET_DUAL_CARRIAGE CARRIAGE=carriage_y G90 G1 X0 Y0 @@ -92,8 +94,8 @@ gcode: gcode: PARK_{printer.toolhead.extruder} ACTIVATE_EXTRUDER EXTRUDER=extruder - SET_DUAL_CARRIAGE CARRIAGE=x - SET_DUAL_CARRIAGE CARRIAGE=y + SET_DUAL_CARRIAGE CARRIAGE=carriage_x + SET_DUAL_CARRIAGE CARRIAGE=carriage_y [extruder1] step_pin: PC1 @@ -115,8 +117,8 @@ max_temp: 250 [gcode_macro PARK_extruder1] gcode: - SET_DUAL_CARRIAGE CARRIAGE=u - SET_DUAL_CARRIAGE CARRIAGE=v + SET_DUAL_CARRIAGE CARRIAGE=carriage_u + SET_DUAL_CARRIAGE CARRIAGE=carriage_v G90 G1 X300 Y200 @@ -124,35 +126,35 @@ gcode: gcode: PARK_{printer.toolhead.extruder} ACTIVATE_EXTRUDER EXTRUDER=extruder1 - SET_DUAL_CARRIAGE CARRIAGE=u - SET_DUAL_CARRIAGE CARRIAGE=v + SET_DUAL_CARRIAGE CARRIAGE=carriage_u + SET_DUAL_CARRIAGE CARRIAGE=carriage_v # A helper script to activate copy mode [gcode_macro ACTIVATE_COPY_MODE] gcode: - SET_DUAL_CARRIAGE CARRIAGE=x MODE=PRIMARY - SET_DUAL_CARRIAGE CARRIAGE=y MODE=PRIMARY + SET_DUAL_CARRIAGE CARRIAGE=carriage_x MODE=PRIMARY + SET_DUAL_CARRIAGE CARRIAGE=carriage_y MODE=PRIMARY G1 X0 Y0 ACTIVATE_EXTRUDER EXTRUDER=extruder - SET_DUAL_CARRIAGE CARRIAGE=u MODE=PRIMARY - SET_DUAL_CARRIAGE CARRIAGE=v MODE=PRIMARY + SET_DUAL_CARRIAGE CARRIAGE=carriage_u MODE=PRIMARY + SET_DUAL_CARRIAGE CARRIAGE=carriage_v MODE=PRIMARY G1 X150 Y100 - SET_DUAL_CARRIAGE CARRIAGE=u MODE=COPY - SET_DUAL_CARRIAGE CARRIAGE=v MODE=COPY + SET_DUAL_CARRIAGE CARRIAGE=carriage_u MODE=COPY + SET_DUAL_CARRIAGE CARRIAGE=carriage_v MODE=COPY SYNC_EXTRUDER_MOTION EXTRUDER=extruder1 MOTION_QUEUE=extruder # A helper script to activate mirror mode [gcode_macro ACTIVATE_MIRROR_MODE] gcode: - SET_DUAL_CARRIAGE CARRIAGE=x MODE=PRIMARY - SET_DUAL_CARRIAGE CARRIAGE=y MODE=PRIMARY + SET_DUAL_CARRIAGE CARRIAGE=carriage_x MODE=PRIMARY + SET_DUAL_CARRIAGE CARRIAGE=carriage_y MODE=PRIMARY G1 X0 Y0 ACTIVATE_EXTRUDER EXTRUDER=extruder - SET_DUAL_CARRIAGE CARRIAGE=u MODE=PRIMARY - SET_DUAL_CARRIAGE CARRIAGE=v MODE=PRIMARY + SET_DUAL_CARRIAGE CARRIAGE=carriage_u MODE=PRIMARY + SET_DUAL_CARRIAGE CARRIAGE=carriage_v MODE=PRIMARY G1 X300 Y100 - SET_DUAL_CARRIAGE CARRIAGE=u MODE=MIRROR - SET_DUAL_CARRIAGE CARRIAGE=v MODE=COPY + SET_DUAL_CARRIAGE CARRIAGE=carriage_u MODE=MIRROR + SET_DUAL_CARRIAGE CARRIAGE=carriage_v MODE=COPY SYNC_EXTRUDER_MOTION EXTRUDER=extruder1 MOTION_QUEUE=extruder [printer] @@ -169,9 +171,9 @@ max_z_accel: 100 #[delayed_gcode init_shaper] #initial_duration: 0.1 #gcode: -# SET_DUAL_CARRIAGE CARRIAGE=u -# SET_DUAL_CARRIAGE CARRIAGE=v -# SET_INPUT_SHAPER SHAPER_TYPE_X= SHAPER_FREQ_X= SHAPER_TYPE_Y= SHAPER_FREQ_Y= -# SET_DUAL_CARRIAGE CARRIAGE=x MODE=PRIMARY -# SET_DUAL_CARRIAGE CARRIAGE=y MODE=PRIMARY -# SET_INPUT_SHAPER SHAPER_TYPE_X= SHAPER_FREQ_X= SHAPER_TYPE_Y= SHAPER_FREQ_Y= +# SET_DUAL_CARRIAGE CARRIAGE=carriage_u +# SET_DUAL_CARRIAGE CARRIAGE=carriage_v +# SET_INPUT_SHAPER SHAPER_TYPE_X= SHAPER_FREQ_X= SHAPER_TYPE_Y= SHAPER_FREQ_Y= +# SET_DUAL_CARRIAGE CARRIAGE=carriage_x MODE=PRIMARY +# SET_DUAL_CARRIAGE CARRIAGE=carriage_y MODE=PRIMARY +# SET_INPUT_SHAPER SHAPER_TYPE_X= SHAPER_FREQ_X= SHAPER_TYPE_Y= SHAPER_FREQ_Y= diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md index cfa2fe9af..6846e034d 100644 --- a/docs/Config_Changes.md +++ b/docs/Config_Changes.md @@ -8,6 +8,10 @@ All dates in this document are approximate. ## Changes +20251122: An option `axis` has been added to `[carriage ]` sections +for `generic_cartesian` kinematics, allowing arbitrary names for primary +carriages. Users are encouraged to explicitly specify `axis` option now. + 20251106: The status fields `{printer.toolhead.position}`, `{printer.gcode_move.position}`, `{printer.gcode_move.gcode_position}`, and diff --git a/docs/Config_Reference.md b/docs/Config_Reference.md index 94d3a9730..dbf2f4eba 100644 --- a/docs/Config_Reference.md +++ b/docs/Config_Reference.md @@ -743,10 +743,12 @@ max_accel: ``` -Then a user must define the following three carriages: `[carriage x]`, -`[carriage y]`, and `[carriage z]`, e.g. +Then a user must define three carriages for X, Y, and Z axes, e.g.: ``` -[carriage x] +[carriage carriage_x] +axis: +# Axis of a carriage, either x, y, or z. This parameter must be provided, +# unless a carriage name is x, y, or z itself. endstop_pin: # Endstop switch detection pin. If this endstop pin is on a # different mcu than the stepper motor(s) moving this carriage, @@ -788,7 +790,8 @@ for instance carriages: # A string describing the carriages the stepper moves. All defined # carriages can be specified here, as well as their linear combinations, -# e.g. x, x+y, y-0.5*z, x-z, etc. This parameter must be provided. +# e.g. carriage_x, carriage_x+carriage_y, carriage_y-0.5*carriage_z, +# carriage_x-carriage_z, etc. This parameter must be provided. step_pin: dir_pin: enable_pin: @@ -800,28 +803,29 @@ microsteps: ``` See [stepper](#stepper) section for more information on the regular stepper parameters. The `carriages` parameter defines how the stepper -affects the motion of the carriages. For example, `x+y` indicates that -the motion of the stepper in the positive direction by the distance `d` -moves the carriages `x` and `y` by the same distance `d` in the positive -direction, while `x-0.5*y` means the motion of the stepper in the positive -direction by the distance `d` moves the carriage `x` by the distance `d` -in the positive direction, but the carriage `y` will travel distance `d/2` -in the negative direction. +affects the motion of the carriages. For example, `carriage_x+carriage_y` +indicates that the motion of the stepper in the positive direction by the +distance `d` moves the carriages `carriage_x` and `carriage_y` by the same +distance `d` in the positive direction, while `carriage_x-0.5*carriage_y` +means the motion of the stepper in the positive direction by the distance +`d` moves the carriage `carriage_x` by the distance `d` in the positive +direction, but the carriage `carriage_y` will travel distance `d/2` in +the negative direction. More than a single stepper motor can be defined to drive the same axis or belt. For example, on a CoreXY AWD setups two motors driving the same belt can be defined as ``` -[carriage x] +[carriage carriage_x] endstop_pin: ... ... -[carriage y] +[carriage carriage_y] endstop_pin: ... ... [stepper a0] -carriages: x-y +carriages: carriage_x-carriage_y step_pin: ... dir_pin: ... enable_pin: ... @@ -829,7 +833,7 @@ rotation_distance: ... ... [stepper a1] -carriages: x-y +carriages: carriage_x-carriage_y step_pin: ... dir_pin: ... enable_pin: ... @@ -842,7 +846,7 @@ sharing the same `carriages` and corresponding endstops. There are situations when a user wants to have more than one endstop per axis. Examples of such configurations include Y axis driven by two independent stepper motors with belts attached to both ends of the -X beam, with effectively two carriages on Y axis each having an +X gantry, with effectively two carriages on Y axis each having an independent endstop, and multi-stepper Z axis with each stepper having its own endstop (not to be confused with the configurations with multiple Z motors but only a single endstop). These configurations @@ -860,12 +864,12 @@ endstop_pin: and the corresponding stepper motors, for example: ``` -[extra_carriage y1] -primary_carriage: y +[extra_carriage carriage_y1] +primary_carriage: carriage_y endstop_pin: ... [stepper sy1] -carriages: y1 +carriages: carriage_y1 ... ``` Notably, an `[extra_carriage]` does not define parameters such as @@ -2450,7 +2454,7 @@ from the configuration described above: [dual_carriage my_dc_carriage] primary_carriage: # Defines the matching primary carriage of this dual carriage and -# the corresponding IDEX axis. Valid choices are x, y, z. +# the corresponding IDEX axis. Must match a name of a defined `[carriage]`. # This parameter must be provided. #safe_distance: # The minimum distance (in mm) to enforce between the dual and the primary @@ -2478,18 +2482,18 @@ on the regular `carriage` parameters. Then a user must define one or more stepper motors moving the dual carriage (and other carriages as appropriate), for instance ``` -[carriage x] +[carriage carriage_x] ... -[carriage y] +[carriage carriage_y] ... -[dual_carriage u] -primary_carriage: x +[dual_carriage carriage_u] +primary_carriage: carriage_x ... [stepper dc_stepper] -carriages: u-y +carriages: carriage_u-carriage_y ... ``` @@ -2505,14 +2509,14 @@ example above: [delayed_gcode init_shaper] initial_duration: 0.1 gcode: - SET_DUAL_CARRIAGE CARRIAGE=u - SET_INPUT_SHAPER SHAPER_TYPE_X= SHAPER_FREQ_X= SHAPER_TYPE_Y= SHAPER_FREQ_Y= - SET_DUAL_CARRIAGE CARRIAGE=x - SET_INPUT_SHAPER SHAPER_TYPE_X= SHAPER_FREQ_X= SHAPER_TYPE_Y= SHAPER_FREQ_Y= + SET_DUAL_CARRIAGE CARRIAGE=carriage_u + SET_INPUT_SHAPER SHAPER_TYPE_X= SHAPER_FREQ_X= SHAPER_TYPE_Y= SHAPER_FREQ_Y= + SET_DUAL_CARRIAGE CARRIAGE=carriage_x + SET_INPUT_SHAPER SHAPER_TYPE_X= SHAPER_FREQ_X= SHAPER_TYPE_Y= SHAPER_FREQ_Y= ``` Note that `SHAPER_TYPE_Y` and `SHAPER_FREQ_Y` must be the same in both commands in this case, since the same motors drive Y axis when either -of the `x` and `u` carriages are active. +of the `carriage_x` and `carriage_u` carriages are active. It is worth noting that `generic_cartesian` kinematic can support two dual carriages for X and Y axes. For reference, see for instance a diff --git a/docs/G-Codes.md b/docs/G-Codes.md index eb38e0134..893993e85 100644 --- a/docs/G-Codes.md +++ b/docs/G-Codes.md @@ -753,11 +753,11 @@ stepper at a time, some sequences of changes can lead to invalid intermediate kinematic configurations, even if the final configuration is valid. In such cases a user can pass `DISABLE_CHECKS=1` parameters to all but the last command to disable intermediate checks. For example, -if `stepper a` and `stepper b` initially have `x-y` and `x+y` carriages -correspondingly, then the following sequence of commands will let a user -effectively swap the carriage controls: -`SET_STEPPER_CARRIAGES STEPPER=a CARRIAGES=x+y DISABLE_CHECKS=1` -and `SET_STEPPER_CARRIAGES STEPPER=b CARRIAGES=x-y`, while +if `stepper a` and `stepper b` initially have `carriage_x-carriage_y` and +`carriage_x+carriage_y` carriages correspondingly, then the following +sequence of commands will let a user effectively swap the carriage controls: +`SET_STEPPER_CARRIAGES STEPPER=a CARRIAGES=carriage_x+carriage_y DISABLE_CHECKS=1` +and `SET_STEPPER_CARRIAGES STEPPER=b CARRIAGES=carriage_x-carriage_y`, while still validating the final kinematics state. ### [hall_filament_width_sensor] diff --git a/docs/Resonance_Compensation.md b/docs/Resonance_Compensation.md index dcfb4ed78..b5a5e5284 100644 --- a/docs/Resonance_Compensation.md +++ b/docs/Resonance_Compensation.md @@ -438,6 +438,8 @@ gcode: SET_DUAL_CARRIAGE CARRIAGE=0 SET_INPUT_SHAPER SHAPER_TYPE_X= SHAPER_FREQ_X= SHAPER_TYPE_Y= SHAPER_FREQ_Y= ``` +However, users of `generic_cartesian` kinematics should specify carriage names +in `CARRIAGE=` parameters of `SET_DUAL_CARRIAGE` instead of their numbers. Note that `SHAPER_TYPE_Y` and `SHAPER_FREQ_Y` should be the same in both commands. If you need to configure an input shaper for Z axis, include its parameters in both `SET_INPUT_SHAPER` commands. diff --git a/klippy/extras/manual_probe.py b/klippy/extras/manual_probe.py index 92f2d0f6f..44b2c719f 100644 --- a/klippy/extras/manual_probe.py +++ b/klippy/extras/manual_probe.py @@ -9,8 +9,11 @@ import logging, bisect def lookup_z_endstop_config(config): if config.has_section('stepper_z'): return config.getsection('stepper_z') - elif config.has_section('carriage z'): - return config.getsection('carriage z') + for cconfig in config.get_prefix_sections('carriage '): + carriage_name = cconfig.get_name().split()[-1].strip() + axis_name = cconfig.get('axis', carriage_name, note_valid=False) + if axis_name == 'z': + return cconfig return None class ManualProbe: diff --git a/klippy/kinematics/generic_cartesian.py b/klippy/kinematics/generic_cartesian.py index 413cc11ca..230997be3 100644 --- a/klippy/kinematics/generic_cartesian.py +++ b/klippy/kinematics/generic_cartesian.py @@ -32,10 +32,16 @@ def mat_pseudo_inverse(m): return pinv class MainCarriage: - def __init__(self, config, axis): + def __init__(self, config): self.rail = stepper.GenericPrinterRail(config) - self.axis = ord(axis) - ord('x') - self.axis_name = axis + carriage_name = self.rail.get_name(short=True) + valid_axes = ['x', 'y', 'z'] + if carriage_name in valid_axes: + axis_name = config.getchoice('axis', valid_axes, carriage_name) + else: + axis_name = config.getchoice('axis', valid_axes) + self.axis = ord(axis_name) - ord('x') + self.axis_name = axis_name self.dual_carriage = None def get_name(self): return self.rail.get_name(short=True) @@ -83,7 +89,7 @@ class DualCarriage: self.axis = self.primary_carriage.get_axis() if self.axis > 1: raise config.error("Invalid axis '%s' for dual_carriage" % - self.primary_carriage.get_axis_name()) + "xyz"[self.axis]) self.safe_dist = config.getfloat('safe_distance', None, minval=0.) def get_name(self): return self.rail.get_name(short=True) @@ -146,11 +152,19 @@ class GenericCartesianKinematics: self.cmd_SET_STEPPER_CARRIAGES, desc=self.cmd_SET_STEPPER_CARRIAGES_help) def _load_kinematics(self, config): - carriages = {a : MainCarriage(config.getsection('carriage ' + a), a) - for a in 'xyz'} + carriages = {} + for mcconfig in config.get_prefix_sections('carriage '): + c = MainCarriage(mcconfig) + axis = c.get_axis() + dups = [mc for mc in carriages.values() if mc.get_axis() == axis] + if dups: + raise config.error( + "Axis '%s' referenced by multiple carriages (%s, %s)" + % ("xyz"[axis], c.get_name(), dups[0].get_name())) + carriages[c.get_name()] = c dc_carriages = [] - for c in config.get_prefix_sections('dual_carriage '): - dc_carriages.append(DualCarriage(c, carriages)) + for dcconfig in config.get_prefix_sections('dual_carriage '): + dc_carriages.append(DualCarriage(dcconfig, carriages)) for dc in dc_carriages: name = dc.get_name() if name in carriages: @@ -159,8 +173,8 @@ class GenericCartesianKinematics: self.carriages = dict(carriages) self.dc_carriages = dc_carriages ec_carriages = [] - for c in config.get_prefix_sections('extra_carriage '): - ec_carriages.append(ExtraCarriage(c, carriages)) + for ecconfig in config.get_prefix_sections('extra_carriage '): + ec_carriages.append(ExtraCarriage(ecconfig, carriages)) for ec in ec_carriages: name = ec.get_name() if name in carriages: @@ -193,13 +207,16 @@ class GenericCartesianKinematics: def get_steppers(self): return [s.get_stepper() for s in self.kin_steppers] def get_primary_carriages(self): - carriages = [self.carriages[a] for a in "xyz"] - if self.dc_module: - for a in self.dc_module.get_axes(): + carriages = [None] * 3 + for carriage in self.carriages.values(): + a = carriage.get_axis() + if carriage.get_dual_carriage() is not None: primary_rail = self.dc_module.get_primary_rail(a) for c in self.carriages.values(): if c.get_rail() == primary_rail: carriages[a] = c + else: + carriages[a] = carriage return carriages def _get_kinematics_coeffs(self): matr = {s.get_name() : list(s.get_kin_coeffs()) @@ -274,11 +291,14 @@ class GenericCartesianKinematics: self._check_kinematics(self.printer.command_error) # Each axis is homed independently and in order for axis in homing_state.get_axes(): - carriage = self.carriages["xyz"[axis]] - if carriage.get_dual_carriage() != None: - self.dc_module.home(homing_state, axis) - else: - self.home_axis(homing_state, axis, carriage.get_rail()) + for carriage in self.carriages.values(): + if carriage.get_axis() != axis: + continue + if carriage.get_dual_carriage() != None: + self.dc_module.home(homing_state, axis) + else: + self.home_axis(homing_state, axis, carriage.get_rail()) + break def _check_endstops(self, move): end_pos = move.end_pos for i in (0, 1, 2): diff --git a/test/klippy/corexyuv.cfg b/test/klippy/corexyuv.cfg index 4c0ab7488..e9b0cd02a 100644 --- a/test/klippy/corexyuv.cfg +++ b/test/klippy/corexyuv.cfg @@ -1,35 +1,38 @@ # Test config for generic cartesian kinematics with dual carriage -[carriage x] +[carriage carriage_x] +axis: x position_endstop: 0 position_max: 300 homing_speed: 50 endstop_pin: ^PE5 -[carriage y] +[carriage carriage_y] +axis: y position_endstop: 0 position_max: 200 homing_speed: 50 endstop_pin: ^PJ1 -[carriage z] +[carriage carriage_z] +axis: z position_endstop: 0.5 position_max: 100 endstop_pin: ^PD3 -[extra_carriage z1] -primary_carriage: z +[extra_carriage carriage_z1] +primary_carriage: carriage_z endstop_pin: ^PD2 -[dual_carriage u] -primary_carriage: x +[dual_carriage carriage_u] +primary_carriage: carriage_x safe_distance: 70 position_endstop: 300 position_max: 300 homing_speed: 50 endstop_pin: ^PE4 -[dual_carriage v] -primary_carriage: y +[dual_carriage carriage_v] +primary_carriage: carriage_y safe_distance: 50 position_endstop: 200 position_max: 200 @@ -37,7 +40,7 @@ homing_speed: 50 endstop_pin: ^PD4 [stepper a] -carriages: x+y +carriages: carriage_x+carriage_y step_pin: PF0 dir_pin: PF1 enable_pin: !PD7 @@ -45,7 +48,7 @@ microsteps: 16 rotation_distance: 40 [stepper b] -carriages: u-v +carriages: carriage_u-carriage_v step_pin: PH1 dir_pin: PH0 enable_pin: !PA1 @@ -53,7 +56,7 @@ microsteps: 16 rotation_distance: 40 [stepper c] -carriages: x-y +carriages: carriage_x-carriage_y step_pin: PF6 dir_pin: !PF7 enable_pin: !PF2 @@ -61,7 +64,7 @@ microsteps: 16 rotation_distance: 40 [stepper d] -carriages: u+v +carriages: carriage_u+carriage_v step_pin: PE3 dir_pin: !PH6 enable_pin: !PG5 @@ -69,7 +72,7 @@ microsteps: 16 rotation_distance: 40 [stepper z] -carriages: z +carriages: carriage_z step_pin: PL3 dir_pin: PL1 enable_pin: !PK0 @@ -77,7 +80,7 @@ microsteps: 16 rotation_distance: 8 [stepper z1] -carriages: z1 +carriages: carriage_z1 step_pin: PG1 dir_pin: PG0 enable_pin: !PH3 @@ -104,8 +107,8 @@ max_temp: 250 [gcode_macro PARK_extruder] gcode: - SET_DUAL_CARRIAGE CARRIAGE=x - SET_DUAL_CARRIAGE CARRIAGE=y + SET_DUAL_CARRIAGE CARRIAGE=carriage_x + SET_DUAL_CARRIAGE CARRIAGE=carriage_y G90 G1 X0 Y0 @@ -114,8 +117,8 @@ gcode: PARK_{printer.toolhead.extruder} SET_SERVO SERVO=my_servo angle=100 ACTIVATE_EXTRUDER EXTRUDER=extruder - SET_DUAL_CARRIAGE CARRIAGE=x - SET_DUAL_CARRIAGE CARRIAGE=y + SET_DUAL_CARRIAGE CARRIAGE=carriage_x + SET_DUAL_CARRIAGE CARRIAGE=carriage_y [extruder1] step_pin: PC1 @@ -137,8 +140,8 @@ max_temp: 250 [gcode_macro PARK_extruder1] gcode: - SET_DUAL_CARRIAGE CARRIAGE=u - SET_DUAL_CARRIAGE CARRIAGE=v + SET_DUAL_CARRIAGE CARRIAGE=carriage_u + SET_DUAL_CARRIAGE CARRIAGE=carriage_v G90 G1 X300 Y200 @@ -147,8 +150,8 @@ gcode: PARK_{printer.toolhead.extruder} SET_SERVO SERVO=my_servo angle=50 ACTIVATE_EXTRUDER EXTRUDER=extruder1 - SET_DUAL_CARRIAGE CARRIAGE=u - SET_DUAL_CARRIAGE CARRIAGE=v + SET_DUAL_CARRIAGE CARRIAGE=carriage_u + SET_DUAL_CARRIAGE CARRIAGE=carriage_v [servo my_servo] pin: PH4 diff --git a/test/klippy/corexyuv.test b/test/klippy/corexyuv.test index 837f9b808..2555e9249 100644 --- a/test/klippy/corexyuv.test +++ b/test/klippy/corexyuv.test @@ -10,12 +10,12 @@ G28 G1 X10 Y20 F6000 # Activate alternate carriage -SET_DUAL_CARRIAGE CARRIAGE=u -SET_DUAL_CARRIAGE CARRIAGE=v +SET_DUAL_CARRIAGE CARRIAGE=carriage_u +SET_DUAL_CARRIAGE CARRIAGE=carriage_v G1 X170 Y190 F6000 # Go back to main carriage on X axis -SET_DUAL_CARRIAGE CARRIAGE=x +SET_DUAL_CARRIAGE CARRIAGE=carriage_x G1 X20 F6000 # Save dual carriage state @@ -24,7 +24,7 @@ SAVE_DUAL_CARRIAGE_STATE G1 Y150 F6000 # Go back to main carriage on Y axis -SET_DUAL_CARRIAGE CARRIAGE=y +SET_DUAL_CARRIAGE CARRIAGE=carriage_y G1 X10 Y50 F6000 # Restore dual carriage state diff --git a/test/klippy/generic_cartesian.cfg b/test/klippy/generic_cartesian.cfg index 361a3f75b..ecf5f8037 100644 --- a/test/klippy/generic_cartesian.cfg +++ b/test/klippy/generic_cartesian.cfg @@ -1,38 +1,41 @@ # Test config for generic cartesian kinematics with dual carriage -[carriage x] +[carriage carriage_x] +axis: x position_endstop: 0 position_max: 300 homing_speed: 50 endstop_pin: ^PE5 -[carriage y] +[carriage carriage_y] +axis: y position_endstop: 0 position_max: 200 homing_speed: 50 endstop_pin: ^PJ1 -[extra_carriage y1] -primary_carriage: y +[extra_carriage carriage_y1] +primary_carriage: carriage_y endstop_pin: ^PB6 -[carriage z] +[carriage carriage_z] +axis: z position_endstop: 0.5 position_max: 100 endstop_pin: ^PD3 -[extra_carriage z1] -primary_carriage: z +[extra_carriage carriage_z1] +primary_carriage: carriage_z endstop_pin: ^PD2 -[dual_carriage u] -primary_carriage: x +[dual_carriage carriage_u] +primary_carriage: carriage_x position_endstop: 300 position_max: 300 homing_speed: 50 endstop_pin: ^PE4 [stepper stepper_x] -carriages: x+y +carriages: carriage_x+carriage_y step_pin: PF0 dir_pin: PF1 enable_pin: !PD7 @@ -40,7 +43,7 @@ microsteps: 16 rotation_distance: 40 [stepper dual_carriage] -carriages: u-y1 +carriages: carriage_u-carriage_y1 step_pin: PH1 dir_pin: PH0 enable_pin: !PA1 @@ -48,7 +51,7 @@ microsteps: 16 rotation_distance: 40 [stepper stepper_y] -carriages: 1*y+0.5*z +carriages: 1*carriage_y+0.5*carriage_z step_pin: PF6 dir_pin: !PF7 enable_pin: !PF2 @@ -56,7 +59,7 @@ microsteps: 16 rotation_distance: 40 [stepper stepper_y1] -carriages: 1*y1-0.5*z1 +carriages: 1*carriage_y1-0.5*carriage_z1 step_pin: PE3 dir_pin: !PH6 enable_pin: !PG5 @@ -64,7 +67,7 @@ microsteps: 16 rotation_distance: 40 [stepper stepper_z] -carriages: z +carriages: carriage_z step_pin: PL3 dir_pin: PL1 enable_pin: !PK0 @@ -72,7 +75,7 @@ microsteps: 16 rotation_distance: 8 [stepper stepper_z1] -carriages: z1 +carriages: carriage_z1 step_pin: PG1 dir_pin: PG0 enable_pin: !PH3 @@ -99,7 +102,7 @@ max_temp: 250 [gcode_macro PARK_extruder] gcode: - SET_DUAL_CARRIAGE CARRIAGE=x + SET_DUAL_CARRIAGE CARRIAGE=carriage_x G90 G1 X0 @@ -108,7 +111,7 @@ gcode: PARK_{printer.toolhead.extruder} SET_SERVO SERVO=my_servo angle=100 ACTIVATE_EXTRUDER EXTRUDER=extruder - SET_DUAL_CARRIAGE CARRIAGE=x + SET_DUAL_CARRIAGE CARRIAGE=carriage_x [extruder1] step_pin: PC1 @@ -130,7 +133,7 @@ max_temp: 250 [gcode_macro PARK_extruder1] gcode: - SET_DUAL_CARRIAGE CARRIAGE=u + SET_DUAL_CARRIAGE CARRIAGE=carriage_u G90 G1 X300 @@ -139,7 +142,7 @@ gcode: PARK_{printer.toolhead.extruder} SET_SERVO SERVO=my_servo angle=50 ACTIVATE_EXTRUDER EXTRUDER=extruder1 - SET_DUAL_CARRIAGE CARRIAGE=u + SET_DUAL_CARRIAGE CARRIAGE=carriage_u [servo my_servo] pin: PH4 diff --git a/test/klippy/generic_cartesian.test b/test/klippy/generic_cartesian.test index 869636a87..373475139 100644 --- a/test/klippy/generic_cartesian.test +++ b/test/klippy/generic_cartesian.test @@ -3,9 +3,9 @@ CONFIG generic_cartesian.cfg DICTIONARY atmega2560.dict # Configure the input shaper -SET_DUAL_CARRIAGE CARRIAGE=u +SET_DUAL_CARRIAGE CARRIAGE=carriage_u SET_INPUT_SHAPER SHAPER_TYPE_X=ei SHAPER_FREQ_X=50 SHAPER_TYPE_Y=2hump_ei SHAPER_FREQ_Y=80 -SET_DUAL_CARRIAGE CARRIAGE=x +SET_DUAL_CARRIAGE CARRIAGE=carriage_x SET_INPUT_SHAPER SHAPER_TYPE_X=ei SHAPER_FREQ_X=50 SHAPER_TYPE_Y=2hump_ei SHAPER_FREQ_Y=80 # Then home the printer @@ -16,11 +16,11 @@ G28 G1 X10 F6000 # Activate alternate carriage -SET_DUAL_CARRIAGE CARRIAGE=u +SET_DUAL_CARRIAGE CARRIAGE=carriage_u G1 X190 F6000 # Go back to main carriage -SET_DUAL_CARRIAGE CARRIAGE=x +SET_DUAL_CARRIAGE CARRIAGE=carriage_x G1 X100 F6000 # Save dual carriage state @@ -29,7 +29,7 @@ SAVE_DUAL_CARRIAGE_STATE G1 X50 F6000 # Go back to alternate carriage -SET_DUAL_CARRIAGE CARRIAGE=u +SET_DUAL_CARRIAGE CARRIAGE=carriage_u G1 X130 F6000 # Restore dual carriage state @@ -46,8 +46,8 @@ G1 X20 E.2 G90 # Test changing the stepper kinematics -SET_STEPPER_CARRIAGES STEPPER=dual_carriage CARRIAGES=u+y1 -SET_STEPPER_CARRIAGES STEPPER=stepper_x CARRIAGES=x-y +SET_STEPPER_CARRIAGES STEPPER=dual_carriage CARRIAGES=carriage_u+carriage_y1 +SET_STEPPER_CARRIAGES STEPPER=stepper_x CARRIAGES=carriage_x-carriage_y G1 X30 E.2 G1 Z3