From e9ce42353edd47edeaef242d4eeccfb8e519cd7d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 20 Sep 2016 04:46:41 -0500 Subject: [PATCH] Patch G29 for 3-point leveling --- Marlin/Conditionals_post.h | 1 + Marlin/Marlin_main.cpp | 16 ++++++++++------ Marlin/qr_solve.cpp | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 3f7730753..2eb3cf474 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -676,6 +676,7 @@ #define AUTO_BED_LEVELING_NONLINEAR #else #define AUTO_BED_LEVELING_LINEAR + #define AUTO_BED_LEVELING_LINEAR_GRID #endif #endif diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 1f86f88dc..63dfcf76b 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -38,7 +38,7 @@ #include "vector_3.h" #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) +#if ENABLED(AUTO_BED_LEVELING_LINEAR_GRID) #include "qr_solve.h" #elif ENABLED(MESH_BED_LEVELING) #include "mesh_bed_leveling.h" @@ -3453,7 +3453,7 @@ inline void gcode_G28() { float zoffset = zprobe_zoffset; if (code_seen('Z')) zoffset += code_value_axis_units(Z_AXIS); - #elif ENABLED(AUTO_BED_LEVELING_LINEAR) + #elif ENABLED(AUTO_BED_LEVELING_LINEAR_GRID) /** * solve the plane equation ax + by + d = z @@ -3471,7 +3471,7 @@ inline void gcode_G28() { mean = 0.0; int indexIntoAB[abl_grid_points_x][abl_grid_points_y]; - #endif // AUTO_BED_LEVELING_LINEAR + #endif // AUTO_BED_LEVELING_LINEAR_GRID int probePointCounter = 0; bool zig = abl_grid_points_y & 1; //always end at [RIGHT_PROBE_BED_POSITION, BACK_PROBE_BED_POSITION] @@ -3506,7 +3506,7 @@ inline void gcode_G28() { measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level); - #if ENABLED(AUTO_BED_LEVELING_LINEAR) + #if ENABLED(AUTO_BED_LEVELING_LINEAR_GRID) mean += measured_z; eqnBVector[probePointCounter] = measured_z; @@ -3576,7 +3576,7 @@ inline void gcode_G28() { if (!dryrun) extrapolate_unprobed_bed_level(); print_bed_level(); - #elif ENABLED(AUTO_BED_LEVELING_LINEAR) + #elif ENABLED(AUTO_BED_LEVELING_LINEAR_GRID) // For LINEAR leveling calculate matrix, print reports, correct the position @@ -3673,6 +3673,10 @@ inline void gcode_G28() { } } //do_topography_map + #endif // AUTO_BED_LEVELING_LINEAR_GRID + + #if ENABLED(AUTO_BED_LEVELING_LINEAR) + // For LINEAR and 3POINT leveling correct the current position if (verbose_level > 0) @@ -6759,7 +6763,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n float xydiff[2] = { offset_vec.x, offset_vec.y }; current_position[Z_AXIS] += offset_vec.z; - #else // !AUTO_BED_LEVELING_FEATURE + #else // !AUTO_BED_LEVELING_LINEAR float xydiff[2] = { hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder], diff --git a/Marlin/qr_solve.cpp b/Marlin/qr_solve.cpp index e60b1d327..0fadd6706 100644 --- a/Marlin/qr_solve.cpp +++ b/Marlin/qr_solve.cpp @@ -22,7 +22,7 @@ #include "qr_solve.h" -#if ENABLED(AUTO_BED_LEVELING_LINEAR) +#if ENABLED(AUTO_BED_LEVELING_LINEAR_GRID) #include #include