From 0e9b8abde2940eb17aad0337cb0dd55f6fadffb9 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 26 Sep 2018 12:15:39 -0400 Subject: probe: Perform multi-sample averaging in ProbePointsHelper class Now that all the callers of ProbePointsHelper take a cartesian coordinate for the probe locations, it's possible to perform averaging of multi-sample probes within the class. This simplifies the callers. Signed-off-by: Kevin O'Connor --- klippy/extras/quad_gantry_level.py | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'klippy/extras/quad_gantry_level.py') diff --git a/klippy/extras/quad_gantry_level.py b/klippy/extras/quad_gantry_level.py index 166ecdbf..9eb1810c 100644 --- a/klippy/extras/quad_gantry_level.py +++ b/klippy/extras/quad_gantry_level.py @@ -39,22 +39,7 @@ class QuadGantryLevel: cmd_QUAD_GANTRY_LEVEL_help = "Conform a moving, twistable gantry to the shape of a stationary bed" def cmd_QUAD_GANTRY_LEVEL(self, params): self.probe_helper.start_probe() - def squash_positions(self,positions): - # Group multi-probe data and average out the Z readings - # Assumes samples come in sequentially - grouped_pos = [] - for position in positions: - if len(grouped_pos) > 0 and round(grouped_pos[-1][0],3) == round(position[0],3) and round(grouped_pos[-1][1],3) == round(position[1],3): - grouped_pos[-1][2].append(position[2]) - else: - grouped_pos.append(position) - grouped_pos[-1][2] = [grouped_pos[-1][2]] - for id,pos in enumerate(grouped_pos): - grouped_pos[id][2] = sum(grouped_pos[id][2]) / len(grouped_pos[id][2]) - return grouped_pos def probe_finalize(self, offsets, positions): - if len(positions) > 4: - positions = self.squash_positions(positions) logging.info("quad_gantry_level Calculating gantry geometry with: %s", positions) p1 = [positions[0][0] + offsets[0],positions[0][2]] p2 = [positions[1][0] + offsets[0],positions[1][2]] -- cgit v1.2.3-70-g09d2