diff --git a/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp b/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp index 38f384671e794b633d0a4d492d32552f2a2e0287..c15659438123bfe945e3bb757bc17d82772f66e9 100644 --- a/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp +++ b/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp @@ -81,6 +81,8 @@ #if ENABLED(EMERGENCY_PARSER) + bool killed_by_M112; // = false + #include "../../module/stepper.h" // Currently looking for: M108, M112, M410 @@ -155,7 +157,7 @@ wait_for_user = wait_for_heatup = false; break; case state_M112: - kill(PSTR(MSG_KILLED)); + killed_by_M112 = true; break; case state_M410: quickstop_stepper(); diff --git a/Marlin/src/HAL/HAL_AVR/MarlinSerial.h b/Marlin/src/HAL/HAL_AVR/MarlinSerial.h index 4bddd5f5053797c2de85d638390780fc80ce85e0..5e21535e48059fabd26615e0395dd6126683fea6 100644 --- a/Marlin/src/HAL/HAL_AVR/MarlinSerial.h +++ b/Marlin/src/HAL/HAL_AVR/MarlinSerial.h @@ -94,6 +94,10 @@ extern ring_buffer_pos_t rx_max_enqueued; #endif + #if ENABLED(EMERGENCY_PARSER) + extern bool killed_by_M112; + #endif + class MarlinSerial { //: public Stream public: diff --git a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp index ef8745876d29d3970c55568dfd822c08fa45cda5..4d7aa945eff383c036076dbb1e2fad827145cfbb 100644 --- a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp @@ -108,6 +108,8 @@ #if ENABLED(EMERGENCY_PARSER) + bool killed_by_M112; // = false + // Currently looking for: M108, M112, M410 // If you alter the parser please don't forget to update the capabilities in Conditionals_post.h @@ -180,7 +182,7 @@ wait_for_user = wait_for_heatup = false; break; case state_M112: - kill(PSTR(MSG_KILLED)); + killed_by_M112 = true; break; case state_M410: quickstop_stepper(); diff --git a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h index a28beaeb1430925c1da3f2823f2c591470791556..01dcd05d523be3f66cbf727cc81f659dbf09aa4f 100644 --- a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h +++ b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h @@ -74,6 +74,10 @@ extern ring_buffer_pos_t rx_max_enqueued; #endif +#if ENABLED(EMERGENCY_PARSER) + extern bool killed_by_M112; +#endif + class MarlinSerial { public: diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index ec3797e6a1116db70869f91571007c5e845573bc..bdee6e6bb046f9af66f4d689cabf670d50c8b990 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -750,6 +750,10 @@ void Temperature::manage_heater() { static bool last_pause_state; #endif + #if ENABLED(EMERGENCY_PARSER) + if (killed_by_M112) kill(PSTR(MSG_KILLED)); + #endif + if (!temp_meas_ready) return; updateTemperaturesFromRawValues(); // also resets the watchdog