diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-09-26 12:15:39 -0400 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2018-10-01 11:12:30 -0400 |
commit | 0e9b8abde2940eb17aad0337cb0dd55f6fadffb9 (patch) | |
tree | fd58c13bb24be6cbd00b7e06e2a58de587598d86 /klippy/extras/bed_mesh.py | |
parent | e5ef15ad0f41f90947fea7f60ad71d86707a7061 (diff) | |
download | kutter-0e9b8abde2940eb17aad0337cb0dd55f6fadffb9.tar.gz kutter-0e9b8abde2940eb17aad0337cb0dd55f6fadffb9.tar.xz kutter-0e9b8abde2940eb17aad0337cb0dd55f6fadffb9.zip |
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>
Diffstat (limited to 'klippy/extras/bed_mesh.py')
-rw-r--r-- | klippy/extras/bed_mesh.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/klippy/extras/bed_mesh.py b/klippy/extras/bed_mesh.py index 6ac3d098..d31c2609 100644 --- a/klippy/extras/bed_mesh.py +++ b/klippy/extras/bed_mesh.py @@ -246,11 +246,10 @@ class BedMeshCalibrate: [0. for i in range(x_cnt)] for j in range(y_cnt)] # Check for multi-sampled points z_table_len = x_cnt * y_cnt - if len(positions) % z_table_len: + if len(positions) != z_table_len: raise self.gcode.error( ("bed_mesh: Invalid probe table length:\n" "Sampled table length: %d") % len(positions)) - samples = len(positions) / z_table_len # Populate the organized probed table for i in range(z_table_len): y_position = i / x_cnt @@ -261,11 +260,8 @@ class BedMeshCalibrate: else: # Odd y count, x probed in the negative directon x_position = (x_cnt - 1) - (i % x_cnt) - idx = i * samples - end = idx + samples - avg_z = sum(p[2] for p in positions[idx:end]) / samples self.probed_z_table[y_position][x_position] = \ - avg_z - z_offset + positions[i][2] - z_offset if self.build_map: outdict = {'z_probe_offsets:': self.probed_z_table} self.gcode.respond(json.dumps(outdict)) |