From f7d885458759484cdebbeaddb240811507ed947c Mon Sep 17 00:00:00 2001 From: Arksine Date: Tue, 12 Feb 2019 19:50:10 -0500 Subject: [PATCH] bed_mesh: simplify configuration The 'bed_shape' option has been removed. The user will enter a 'bed_radius' if they have a round be, otherwise they should enter 'min_point' and 'max_point'. When the bed is round the user should supply a 'round_probe_count' option, otherwise just 'probe_count'. Signed-off-by: Eric Callahan --- config/example-extras.cfg | 46 ++++++++++++++++++--------------------- docs/Config_Changes.md | 4 ++++ klippy/extras/bed_mesh.py | 9 +++----- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/config/example-extras.cfg b/config/example-extras.cfg index d22311a3..5aed46d6 100644 --- a/config/example-extras.cfg +++ b/config/example-extras.cfg @@ -129,14 +129,14 @@ # center of the print area. # # Visual Examples: -# bed_shape = rectangular, probe_count = 3,3: +# rectangular bed, probe_count = 3,3: # x---x---x (max_point) # | # x---x---x # | # (min_point) x---x---x # -# bed_shape = round, probe_count = 5, radius = r: +# round bed, round_probe_count = 5, bed_radius = r: # x (0,r) end # / # x---x---x @@ -160,34 +160,30 @@ #sample_retract_dist: 2.0 # The distance (in mm) to retract between each sample if # sampling more than once. Default is 2mm. -#bed_shape: rectangular -# Defines the shape of the bed for probing. May be 'rectangular', -# as is common for cartesian printers, or 'round', as is common for -# delta printers. Default is rectangular. -#radius: -# Defines the radius to probe when the bed_shape is 'round'. Note -# that the radius is relative to the nozzle's origin, if using a -# probe be sure to account for its offset. This parameter must be -# provided if the bed_shape is 'round'. +#bed_radius: +# Defines the radius to probe for round beds. Note that the radius +# is relative to the nozzle's origin, if using a probe be sure to +# account for its offset. This parameter must be provided for round +# beds and omitted for rectangular beds. #min_point: -# Defines the minimum x,y position to probe when the bed_shape -# is 'rectangular'. Note that this refers to the nozzle position, -# take care that you do not define a point that will move the -# probe off of the bed. This parameter must be provided. +# Defines the minimum x,y position to probe when for rectangular +# beds. Note that this refers to the nozzle position, take care that +# you do not define a point that will move the probe off of the bed. +# This parameter must be provided for rectangular beds. #max_point: -# Defines the maximum x,y position to probe when the bed_shape -# is 'rectangular'. Follow the same precautions as listed in min_point. -# Also note that this does not necessarily define the last point -# probed, only the maximum coordinate. This parameter must be provided. +# Defines the maximum x,y position to probe when for rectangular +# beds. Follow the same precautions as listed in min_point. Also note +# that this does not necessarily define the last point probed, only +# the maximum coordinate. This parameter must be provided. #probe_count: 3,3 -## OR ## -#probe_count: 5 -# For 'rectangular' beds, this is a comma separate pair of integer +# For rectangular beds, this is a comma separate pair of integer # values (X,Y) defining the number of points to probe along each axis. # A single value is also valid, in which case that value will be applied -# to both axes. 'Round' beds only accept a single integer value that is -# applied to both axes. The probe count must be odd for round beds. -# Default is 3,3 for 'rectangular' beds, and 5 for 'round' beds. +# to both axes. Default is 3,3. +#round_probe_count: 5 +# For round beds, this is integer value defines the maximum number of +# points to probe along each axis. This value must be an odd number. +# Default is 5. #fade_start: 1.0 # The gcode z position in which to start phasing out z-adjustment # when fade is enabled. Default is 1.0. diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md index fa2d295f..1f0a6445 100644 --- a/docs/Config_Changes.md +++ b/docs/Config_Changes.md @@ -6,6 +6,10 @@ All dates in this document are approximate. # Changes +20190224: The bed_shape option has been removed from bed_mesh. The +radius option has been renamed to bed_radius. Users with round beds +should supply the bed_radius and round_probe_count options. + 20190107: The i2c_address parameter in the mcp4451 config section changed. This is a common setting on Smoothieboards. The new value is half the old value (88 should be changed to 44, and 90 should be diff --git a/klippy/extras/bed_mesh.py b/klippy/extras/bed_mesh.py index 3d606004..506d5aa1 100644 --- a/klippy/extras/bed_mesh.py +++ b/klippy/extras/bed_mesh.py @@ -10,8 +10,6 @@ import json import probe import collections -BED_SHAPES = {'rectangular': 0, 'round': 1} - class BedMeshError(Exception): pass @@ -210,14 +208,13 @@ class BedMeshCalibrate: 'BED_MESH_PROFILE', self.cmd_BED_MESH_PROFILE, desc=self.cmd_BED_MESH_PROFILE_help) def _generate_points(self, config): - shape = config.getchoice('bed_shape', BED_SHAPES, 'rectangular') - if shape == BED_SHAPES['round']: - x_cnt = y_cnt = config.getint('probe_count', 5) + self.radius = config.getfloat('bed_radius', None, above=0.) + if self.radius is not None: + x_cnt = y_cnt = config.getint('round_probe_count', 5, minval=3) # round beds must have an odd number of points along each axis if not x_cnt & 1: raise config.error( "bed_mesh: probe_count must be odd for round beds") - self.radius = config.getfloat('radius', above=0.) # radius may have precision to .1mm self.radius = math.floor(self.radius * 10) / 10 min_x = min_y = -self.radius