mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-21 13:48:00 -06:00
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 <kevin@koconnor.net>
This commit is contained in:
parent
e5ef15ad0f
commit
0e9b8abde2
4 changed files with 10 additions and 26 deletions
|
@ -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]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue