Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gbkwiatt committed Feb 15, 2024
2 parents fb8c678 + 4f00f21 commit c6de8c9
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 107 deletions.
12 changes: 4 additions & 8 deletions config/printer-geeetech-301-2019.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,21 @@ pid_Kp: 39
pid_Ki: 2
pid_Kd: 210

[extruder1]
[extruder_stepper e1]
extruder:
step_pin: PA0
dir_pin: !PB6
enable_pin: !PA1
microsteps: 16
rotation_distance: 32
nozzle_diameter: 0.4
filament_diameter: 1.75
shared_heater: extruder

[extruder2]
[extruder_stepper e2]
extruder:
step_pin: PB2
dir_pin: !PB11
enable_pin: !PC4
microsteps: 16
rotation_distance: 32
nozzle_diameter: 0.4
filament_diameter: 1.75
shared_heater: extruder

[heater_bed]
heater_pin: PB1
Expand Down
1 change: 0 additions & 1 deletion config/printer-modix-big60-2020.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ algorithm: bicubic
bicubic_tension: 0.15
fade_start: 0.5
fade_end: 2.5
relative_reference_index: 60

[bed_screws]
screw1: 0,0
Expand Down
14 changes: 11 additions & 3 deletions docs/Bed_Mesh.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,19 @@ This gcode may be used to clear the internal mesh state.

### Apply X/Y offsets

`BED_MESH_OFFSET [X=<value>] [Y=<value>]`
`BED_MESH_OFFSET [X=<value>] [Y=<value>] [ZFADE=<value>]`

This is useful for printers with multiple independent extruders, as an offset
is necessary to produce correct Z adjustment after a tool change. Offsets
should be specified relative to the primary extruder. That is, a positive
X offset should be specified if the secondary extruder is mounted to the
right of the primary extruder, and a positive Y offset should be specified
if the secondary extruder is mounted "behind" the primary extruder.
right of the primary extruder, a positive Y offset should be specified
if the secondary extruder is mounted "behind" the primary extruder, and
a positive ZFADE offset should be specified if the secondary extruder's
nozzle is above the primary extruder's.

Note that a ZFADE offset does *NOT* directly apply additional adjustment. It
is intended to compensate for a `gcode offset` when [mesh fade](#mesh-fade)
is enabled. For example, if a secondary extruder is higher than the primary
and needs a negative gcode offset, ie: `SET_GCODE_OFFSET Z=-.2`, it can be
accounted for in `bed_mesh` with `BED_MESH_OFFSET ZFADE=.2`.
8 changes: 8 additions & 0 deletions docs/Config_Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ All dates in this document are approximate.

## Changes

20240215: Several deprecated features have been removed. Using "NTC
100K beta 3950" as a thermistor name has been removed (deprecated on
20211110). The `SYNC_STEPPER_TO_EXTRUDER` and
`SET_EXTRUDER_STEP_DISTANCE` commands have been removed, and the
extruder `shared_heater` config option has been removed (deprecated on
20220210). The bed_mesh `relative_reference_index` option has been
removed (deprecated on 20230619).

20240123: The output_pin SET_PIN CYCLE_TIME parameter has been
removed. Use the new
[pwm_cycle_time](Config_Reference.md#pwm_cycle_time) module if it is
Expand Down
7 changes: 0 additions & 7 deletions docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -979,13 +979,6 @@ Visual Examples:
# where Z = 0. When this option is specified the mesh will be offset
# so that zero Z adjustment occurs at this location. The default is
# no zero reference.
#relative_reference_index:
# **DEPRECATED, use the "zero_reference_position" option**
# The legacy option superceded by the "zero reference position".
# Rather than a coordinate this option takes an integer "index" that
# refers to the location of one of the generated points. It is recommended
# to use the "zero_reference_position" instead of this option for new
# configurations. The default is no relative reference index.
#faulty_region_1_min:
#faulty_region_1_max:
# Optional points that define a faulty region. See docs/Bed_Mesh.md
Expand Down
16 changes: 6 additions & 10 deletions docs/G-Codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ SAVE_CONFIG gcode must be run to make the changes to persistent memory
permanent.

#### BED_MESH_OFFSET
`BED_MESH_OFFSET [X=<value>] [Y=<value>]`: Applies X and/or Y offsets
to the mesh lookup. This is useful for printers with independent
extruders, as an offset is necessary to produce correct Z adjustment
after a tool change.
`BED_MESH_OFFSET [X=<value>] [Y=<value>] [ZFADE=<value]`: Applies X, Y,
and/or ZFADE offsets to the mesh lookup. This is useful for printers with
independent extruders, as an offset is necessary to produce correct Z
adjustment after a tool change. Note that a ZFADE offset does not apply
additional z-adjustment directly, it is used to correct the `fade`
calculation when a `gcode offset` has been applied to the Z axis.

### [bed_screws]

Expand Down Expand Up @@ -447,12 +449,6 @@ MOTION_QUEUE (as defined in an [extruder](Config_Reference.md#extruder)
config section). If MOTION_QUEUE is an empty string then the stepper
will be desynchronized from all extruder movement.

#### SET_EXTRUDER_STEP_DISTANCE
This command is deprecated and will be removed in the near future.

#### SYNC_STEPPER_TO_EXTRUDER
This command is deprecated and will be removed in the near future.

### [fan_generic]

The following command is available when a
Expand Down
2 changes: 1 addition & 1 deletion docs/Skew_Correction.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ or by issuing a `SET_SKEW CLEAR=1` gcode.

## Take your measurements

The `[skew_correcton]` module requires 3 measurements for each plane you want
The `[skew_correction]` module requires 3 measurements for each plane you want
to correct; the length from Corner A to Corner C, the length from Corner B
to Corner D, and the length from Corner A to Corner D. When measuring length
AD do not include the flats on the corners that some test objects provide.
Expand Down
55 changes: 16 additions & 39 deletions klippy/extras/bed_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def __init__(self, config):
self.log_fade_complete = False
self.base_fade_target = config.getfloat('fade_target', None)
self.fade_target = 0.
self.tool_offset = 0.
self.gcode = self.printer.lookup_object('gcode')
self.splitter = MoveSplitter(config, self.gcode)
# setup persistent storage
Expand Down Expand Up @@ -157,13 +158,15 @@ def set_mesh(self, mesh):
"mesh max: %.4f" % (self.fade_dist, min_z, max_z))
else:
self.fade_target = 0.
self.tool_offset = 0.
self.z_mesh = mesh
self.splitter.initialize(mesh, self.fade_target)
# cache the current position before a transform takes place
gcode_move = self.printer.lookup_object('gcode_move')
gcode_move.reset_last_position()
self.update_status()
def get_z_factor(self, z_pos):
z_pos += self.tool_offset
if z_pos >= self.fade_end:
return 0.
elif z_pos >= self.fade_start:
Expand All @@ -182,14 +185,15 @@ def get_position(self):
max_adj = self.z_mesh.calc_z(x, y)
factor = 1.
z_adj = max_adj - self.fade_target
if min(z, (z - max_adj)) >= self.fade_end:
fade_z_pos = z + self.tool_offset
if min(fade_z_pos, (fade_z_pos - max_adj)) >= self.fade_end:
# Fade out is complete, no factor
factor = 0.
elif max(z, (z - max_adj)) >= self.fade_start:
elif max(fade_z_pos, (fade_z_pos - max_adj)) >= self.fade_start:
# Likely in the process of fading out adjustment.
# Because we don't yet know the gcode z position, use
# algebra to calculate the factor from the toolhead pos
factor = ((self.fade_end + self.fade_target - z) /
factor = ((self.fade_end + self.fade_target - fade_z_pos) /
(self.fade_dist - z_adj))
factor = constrain(factor, 0., 1.)
final_z_adj = factor * z_adj + self.fade_target
Expand Down Expand Up @@ -271,6 +275,9 @@ def cmd_BED_MESH_OFFSET(self, gcmd):
for i, axis in enumerate(['X', 'Y']):
offsets[i] = gcmd.get_float(axis, None)
self.z_mesh.set_mesh_offsets(offsets)
tool_offset = gcmd.get_float("ZFADE", None)
if tool_offset is not None:
self.tool_offset = tool_offset
gcode_move = self.printer.lookup_object('gcode_move')
gcode_move.reset_last_position()
else:
Expand All @@ -294,19 +301,6 @@ def __init__(self, config, bedmesh):
self.zero_ref_pos = config.getfloatlist(
"zero_reference_position", None, count=2
)
self.relative_reference_index = config.getint(
'relative_reference_index', None, minval=0)
config.deprecate('relative_reference_index')
if (
self.zero_ref_pos is not None and
self.relative_reference_index is not None
):
self.relative_reference_index = None
logging.info(
"bed_mesh: both 'zero_reference_postion' and "
"'relative_reference_index' options are specified, "
"the 'zero_reference_position' value will be used."
)
self.zero_reference_mode = ZrefMode.DISABLED
self.faulty_regions = []
self.substituted_indices = collections.OrderedDict()
Expand Down Expand Up @@ -366,12 +360,6 @@ def _generate_points(self, error, probe_method="automatic"):
(self.origin[0] + pos_x, self.origin[1] + pos_y))
pos_y += y_dist
self.points = points
rri = self.relative_reference_index
if self.zero_ref_pos is None and rri is not None:
# Zero ref position needs to be initialized
if rri >= len(self.points):
raise error("bed_mesh: relative reference index out of range")
self.zero_ref_pos = points[rri]
if self.zero_ref_pos is None or probe_method == "manual":
# Zero Reference Disabled
self.zero_reference_mode = ZrefMode.DISABLED
Expand All @@ -389,8 +377,6 @@ def _generate_points(self, error, probe_method="automatic"):
for min_c, max_c in self.faulty_regions:
if within(self.zero_ref_pos, min_c, max_c):
opt = "zero_reference_position"
if self.relative_reference_index is not None:
opt = "relative_reference_index"
raise error(
"bed_mesh: Cannot probe zero reference position at "
"(%.2f, %.2f) as it is located within a faulty region."
Expand Down Expand Up @@ -449,17 +435,10 @@ def print_generated_points(self, print_func):
print_func(
" %-4d| %-16s| %s" % (i, adj_pt, mesh_pt))
if self.zero_ref_pos is not None:
rri = self.relative_reference_index
if rri is not None:
print_func(
"bed_mesh: relative_reference_index %d is (%.2f, %.2f)"
% (rri, self.zero_ref_pos[0], self.zero_ref_pos[1])
)
else:
print_func(
"bed_mesh: zero_reference_position is (%.2f, %.2f)"
% (self.zero_ref_pos[0], self.zero_ref_pos[1])
)
print_func(
"bed_mesh: zero_reference_position is (%.2f, %.2f)"
% (self.zero_ref_pos[0], self.zero_ref_pos[1])
)
if self.substituted_indices:
print_func("bed_mesh: faulty region points")
for i, v in self.substituted_indices.items():
Expand Down Expand Up @@ -735,10 +714,8 @@ def update_config(self, gcmd):
self.print_generated_points(gcmd.respond_info)
pts = self._get_adjusted_points()
self.probe_helper.update_probe_points(pts, 3)
msg = "relative_reference_index: %s\n" % \
(self.relative_reference_index)
msg += "\n".join(["%s: %s" % (k, v) for k, v
in self.mesh_config.items()])
msg = "\n".join(["%s: %s" % (k, v)
for k, v in self.mesh_config.items()])
logging.info("Updated Mesh Configuration:\n" + msg)
else:
self._generate_points(gcmd.error, probe_method)
Expand Down
2 changes: 0 additions & 2 deletions klippy/extras/heaters.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@ def setup_sensor(self, config):
if sensor_type not in self.sensor_factories:
raise self.printer.config_error(
"Unknown temperature sensor '%s'" % (sensor_type,))
if sensor_type == 'NTC 100K beta 3950':
config.deprecate('sensor_type', 'NTC 100K beta 3950')
return self.sensor_factories[sensor_type](config)
def register_sensor(self, config, psensor, gcode_id=None):
self.available_sensors.append(config.get_name())
Expand Down
6 changes: 0 additions & 6 deletions klippy/extras/temperature_sensors.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,6 @@ temperature1: 25
resistance1: 100000
beta: 3974

# Definition inherent from name. This sensor is deprecated!
[thermistor NTC 100K beta 3950]
temperature1: 25
resistance1: 100000
beta: 3950

# Definition from description of Marlin "thermistor 75"
[thermistor NTC 100K MGB18-104F39050L32]
temperature1: 25
Expand Down
31 changes: 1 addition & 30 deletions klippy/kinematics/extruder.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ def __init__(self, config):
gcode.register_mux_command("SYNC_EXTRUDER_MOTION", "EXTRUDER",
self.name, self.cmd_SYNC_EXTRUDER_MOTION,
desc=self.cmd_SYNC_EXTRUDER_MOTION_help)
gcode.register_mux_command("SET_EXTRUDER_STEP_DISTANCE", "EXTRUDER",
self.name, self.cmd_SET_E_STEP_DISTANCE,
desc=self.cmd_SET_E_STEP_DISTANCE_help)
gcode.register_mux_command("SYNC_STEPPER_TO_EXTRUDER", "STEPPER",
self.name, self.cmd_SYNC_STEPPER_TO_EXTRUDER,
desc=self.cmd_SYNC_STEPPER_TO_EXTRUDER_help)
def _handle_connect(self):
toolhead = self.printer.lookup_object('toolhead')
toolhead.register_step_generator(self.stepper.generate_steps)
Expand Down Expand Up @@ -133,24 +127,6 @@ def cmd_SYNC_EXTRUDER_MOTION(self, gcmd):
self.sync_to_extruder(ename)
gcmd.respond_info("Extruder '%s' now syncing with '%s'"
% (self.name, ename))
cmd_SET_E_STEP_DISTANCE_help = "Set extruder step distance"
def cmd_SET_E_STEP_DISTANCE(self, gcmd):
step_dist = gcmd.get_float('DISTANCE', None, above=0.)
if step_dist is not None:
toolhead = self.printer.lookup_object('toolhead')
toolhead.flush_step_generation()
rd, steps_per_rotation = self.stepper.get_rotation_distance()
self.stepper.set_rotation_distance(step_dist * steps_per_rotation)
else:
step_dist = self.stepper.get_step_dist()
gcmd.respond_info("Extruder '%s' step distance set to %0.6f"
% (self.name, step_dist))
cmd_SYNC_STEPPER_TO_EXTRUDER_help = "Set extruder stepper"
def cmd_SYNC_STEPPER_TO_EXTRUDER(self, gcmd):
ename = gcmd.get('EXTRUDER')
self.sync_to_extruder(ename)
gcmd.respond_info("Extruder '%s' now syncing with '%s'"
% (self.name, ename))

# Tracking for hotend heater, extrusion motion queue, and extruder stepper
class PrinterExtruder:
Expand All @@ -159,14 +135,9 @@ def __init__(self, config, extruder_num):
self.name = config.get_name()
self.last_position = 0.
# Setup hotend heater
shared_heater = config.get('shared_heater', None)
pheaters = self.printer.load_object(config, 'heaters')
gcode_id = 'T%d' % (extruder_num,)
if shared_heater is None:
self.heater = pheaters.setup_heater(config, gcode_id)
else:
config.deprecate('shared_heater')
self.heater = pheaters.lookup_heater(shared_heater)
self.heater = pheaters.setup_heater(config, gcode_id)
# Setup kinematic checks
self.nozzle_diameter = config.getfloat('nozzle_diameter', above=0.)
filament_diameter = config.getfloat(
Expand Down

0 comments on commit c6de8c9

Please sign in to comment.