From 837df6108cee3b73505007689d38aee46893810b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 16 Apr 2016 20:30:12 -0700 Subject: [PATCH] Fix borked set_bed_level_equation_lsq --- Marlin/Marlin_main.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 63942d8e01..ab0a24ebf1 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1413,9 +1413,6 @@ static void setup_for_endstop_move() { static void set_bed_level_equation_lsq(double* plane_equation_coefficients) { - vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1); - plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal); - //plan_bed_level_matrix.debug("bed level before"); #if ENABLED(DEBUG_LEVELING_FEATURE) @@ -1427,14 +1424,16 @@ static void setup_for_endstop_move() { } #endif + vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1); + plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal); + vector_3 corrected_position = plan_get_position(); - current_position[X_AXIS] = corrected_position.x; current_position[Y_AXIS] = corrected_position.y; current_position[Z_AXIS] = corrected_position.z; #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("<<< set_bed_level_equation_lsq", current_position); + if (DEBUGGING(LEVELING)) DEBUG_POS("<<< set_bed_level_equation_lsq", corrected_position); #endif sync_plan_position();