bed_tilt: Take into account probe xy offset when calculating z_adjust

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-09-26 14:26:55 -04:00 committed by KevinOConnor
parent 348a41c325
commit 19d18c2bc1
1 changed files with 6 additions and 5 deletions

View File

@ -73,10 +73,11 @@ class BedTiltCalibrate:
new_params = mathutil.coordinate_descent(
params.keys(), params, errorfunc)
# Update current bed_tilt calculations
z_diff = new_params['z_adjust'] - z_offset
bed_tilt = self.printer.lookup_object('bed_tilt')
bed_tilt.update_adjust(new_params['x_adjust'], new_params['y_adjust'],
z_diff)
x_adjust = new_params['x_adjust']
y_adjust = new_params['y_adjust']
z_adjust = (new_params['z_adjust'] - z_offset
- x_adjust * offsets[0] - y_adjust * offsets[1])
self.bedtilt.update_adjust(x_adjust, y_adjust, z_adjust)
self.gcode.reset_last_position()
# Log and report results
logging.info("Calculated bed_tilt parameters: %s", new_params)
@ -84,7 +85,7 @@ class BedTiltCalibrate:
logging.info("orig: %s new: %s", adjusted_height(pos, params),
adjusted_height(pos, new_params))
msg = "x_adjust: %.6f y_adjust: %.6f z_adjust: %.6f" % (
new_params['x_adjust'], new_params['y_adjust'], z_diff)
x_adjust, y_adjust, z_adjust)
self.printer.set_rollover_info("bed_tilt", "bed_tilt: %s" % (msg,))
self.gcode.respond_info(
"%s\nThe above parameters have been applied to the current\n"