From 5923276a86984452a5269809e383396d9ef6332c Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 6 Apr 2021 00:12:01 +0200 Subject: [PATCH] G80: correctly abort during crash detection Crash detection is handled at a higher level (which automatically repeats the current command), however we still need to abort the current command correctly. Handle XY crashes by checking the planner status after st_synchronize(). --- Firmware/Marlin_main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index b024c3ce..3cd28077 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3036,6 +3036,8 @@ static void gcode_G80() plan_buffer_line_curposXYZE(XY_AXIS_FEEDRATE); // Wait until the move is finished. st_synchronize(); + if (waiting_inside_plan_buffer_line_print_aborted) + return; uint8_t mesh_point = 0; //index number of calibration point int Z_LIFT_FEEDRATE = homing_feedrate[Z_AXIS] / 40; @@ -3105,6 +3107,8 @@ static void gcode_G80() //printf_P(PSTR("after clamping: [%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]); plan_buffer_line_curposXYZE(XY_AXIS_FEEDRATE); st_synchronize(); + if (waiting_inside_plan_buffer_line_print_aborted) + return; // Go down until endstop is hit const float Z_CALIBRATION_THRESHOLD = 1.f;