From 7f2a8362517181cde5b98bf88aa48821355f7692 Mon Sep 17 00:00:00 2001 From: ExtNeon <33217029+ExtNeon@users.noreply.github.com> Date: Sat, 6 Aug 2022 23:37:03 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20SD=20Endstop=20Abort=20G-Code=20(#2?= =?UTF-8?q?4461)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 3 +++ Marlin/src/module/endstops.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 921d36b7a8..b1a7662e71 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1589,6 +1589,9 @@ * Endstops must be activated for this option to work. */ //#define SD_ABORT_ON_ENDSTOP_HIT + #if ENABLED(SD_ABORT_ON_ENDSTOP_HIT) + //#define SD_ABORT_ON_ENDSTOP_HIT_GCODE "G28XY" // G-code to run on endstop hit (e.g., "G28XY" or "G27") + #endif //#define SD_REPRINT_LAST_SELECTED_FILE // On print completion open the LCD Menu and select the same file diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 33c94ae357..f4fbda747b 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -551,6 +551,10 @@ void Endstops::event_handler() { card.abortFilePrintNow(); quickstop_stepper(); thermalManager.disable_all_heaters(); + #ifdef SD_ABORT_ON_ENDSTOP_HIT_GCODE + queue.clear(); + queue.inject(F(SD_ABORT_ON_ENDSTOP_HIT_GCODE)); + #endif print_job_timer.stop(); } #endif