From b961251899ff045a4d3da4d8e3816ed9876befd0 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Thu, 27 Jun 2019 14:00:55 -0400 Subject: [PATCH] Add Z_PROBE_END_SCRIPT to UBL (#14419) --- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 7a1eb112f..2ecaab692 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -306,6 +306,7 @@ void unified_bed_leveling::G29() { + bool probe_deployed = false; if (g29_parameter_parsing()) return; // Abort on parameter error const int8_t p_val = parser.intval('P', -1); @@ -418,6 +419,7 @@ } do_blocking_move_to_xy(0.5f * (MESH_MAX_X - (MESH_MIN_X)), 0.5f * (MESH_MAX_Y - (MESH_MIN_Y))); report_current_position(); + probe_deployed = true; } #endif // HAS_BED_PROBE @@ -457,6 +459,7 @@ parser.seen('T'), parser.seen('E'), parser.seen('U')); report_current_position(); + probe_deployed = true; break; #endif // HAS_BED_PROBE @@ -492,6 +495,7 @@ SERIAL_ECHOLNPGM("?Error in Business Card measurement."); return; } + probe_deployed = true; } if (!position_is_reachable(g29_x_pos, g29_y_pos)) { @@ -671,6 +675,14 @@ ui.release(); #endif + #ifdef Z_PROBE_END_SCRIPT + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Z Probe End Script: ", Z_PROBE_END_SCRIPT); + if (probe_deployed) { + planner.synchronize(); + process_subcommands_now_P(PSTR(Z_PROBE_END_SCRIPT)); + } + #endif + return; }