From cda5ef08fad18c728523a6ee7b2f05355e47799c Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Tue, 13 Nov 2018 11:20:21 -0600 Subject: [PATCH] Debug of G2-G3 for UBL (#12386) Changes only affect UBL. Everything else is left alone. --- Marlin/src/gcode/bedlevel/G26.cpp | 19 ++++++++++++++++--- Marlin/src/gcode/motion/G2_G3.cpp | 15 ++++++++++++++- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index 7a44109262..174505d585 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -227,11 +227,11 @@ void move_to(const float &rx, const float &ry, const float &z, const float &e_de if (z != last_z) { last_z = z; - feed_value = planner.settings.max_feedrate_mm_s[Z_AXIS]/(3.0); // Base the feed rate off of the configured Z_AXIS feed rate + feed_value = planner.settings.max_feedrate_mm_s[Z_AXIS]/(2.0); // Base the feed rate off of the configured Z_AXIS feed rate destination[X_AXIS] = current_position[X_AXIS]; destination[Y_AXIS] = current_position[Y_AXIS]; - destination[Z_AXIS] = z; // We know the last_z==z or we wouldn't be in this block of code. + destination[Z_AXIS] = z; // We know the last_z!=z or we wouldn't be in this block of code. destination[E_AXIS] = current_position[E_AXIS]; G26_line_to_destination(feed_value); @@ -240,7 +240,7 @@ void move_to(const float &rx, const float &ry, const float &z, const float &e_de // Check if X or Y is involved in the movement. // Yes: a 'normal' movement. No: a retract() or recover() - feed_value = has_xy_component ? PLANNER_XY_FEEDRATE() / 10.0 : planner.settings.max_feedrate_mm_s[E_AXIS] / 1.5; + feed_value = has_xy_component ? PLANNER_XY_FEEDRATE() / 3.0 : planner.settings.max_feedrate_mm_s[E_AXIS] / 1.5; if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value); @@ -819,6 +819,19 @@ void GcodeSuite::G26() { recover_filament(destination); const float save_feedrate = feedrate_mm_s; feedrate_mm_s = PLANNER_XY_FEEDRATE() / 10.0; + + if (g26_debug_flag) { + SERIAL_ECHOPAIR(" plan_arc(ex=", endpoint[X_AXIS]); + SERIAL_ECHOPAIR(", ey=", endpoint[Y_AXIS]); + SERIAL_ECHOPAIR(", ez=", endpoint[Z_AXIS]); + SERIAL_ECHOPAIR(", len=", arc_offset); + SERIAL_ECHOPAIR(") -> (ex=", current_position[X_AXIS]); + SERIAL_ECHOPAIR(", ey=", current_position[Y_AXIS]); + SERIAL_ECHOPAIR(", ez=", current_position[Z_AXIS]); + SERIAL_CHAR(')'); + SERIAL_EOL(); + } + plan_arc(endpoint, arc_offset, false); // Draw a counter-clockwise arc feedrate_mm_s = save_feedrate; set_destination_from_current(); diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index 0ae3f8574f..b592b31baa 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -70,6 +70,9 @@ void plan_arc( float r_P = -offset[0], r_Q = -offset[1]; const float radius = HYPOT(r_P, r_Q), + #if ENABLED(AUTO_BED_LEVELING_UBL) + start_L = current_position[l_axis], + #endif center_P = current_position[p_axis] - r_P, center_Q = current_position[q_axis] - r_Q, rt_X = cart[p_axis] - center_P, @@ -179,7 +182,11 @@ void plan_arc( // Update raw location raw[p_axis] = center_P + r_P; raw[q_axis] = center_Q + r_Q; - raw[l_axis] += linear_per_segment; + #if ENABLED(AUTO_BED_LEVELING_UBL) + raw[l_axis] = start_L; + #else + raw[l_axis] += linear_per_segment; + #endif raw[E_AXIS] += extruder_per_segment; clamp_to_software_endstops(raw); @@ -198,6 +205,9 @@ void plan_arc( // Ensure last segment arrives at target location. COPY(raw, cart); + #if ENABLED(AUTO_BED_LEVELING_UBL) + raw[l_axis] = start_L; + #endif #if HAS_LEVELING && !PLANNER_LEVELING planner.apply_leveling(raw); @@ -209,6 +219,9 @@ void plan_arc( #endif ); + #if ENABLED(AUTO_BED_LEVELING_UBL) + raw[l_axis] = start_L; + #endif COPY(current_position, raw); } // plan_arc