From 2ecc3bb5608cf7e9e4e58ccd469a7ecff442a572 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Fri, 16 Oct 2020 18:11:00 -0300 Subject: [PATCH] Handle M410 in the main task (#19752) --- Marlin/src/feature/e_parser.cpp | 1 + Marlin/src/feature/e_parser.h | 3 ++- Marlin/src/module/temperature.cpp | 10 ++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Marlin/src/feature/e_parser.cpp b/Marlin/src/feature/e_parser.cpp index a4c2d0dac9..d98afcfee7 100644 --- a/Marlin/src/feature/e_parser.cpp +++ b/Marlin/src/feature/e_parser.cpp @@ -32,6 +32,7 @@ // Static data members bool EmergencyParser::killed_by_M112, // = false + EmergencyParser::quickstop_by_M410, EmergencyParser::enabled; #if ENABLED(HOST_PROMPT_SUPPORT) diff --git a/Marlin/src/feature/e_parser.h b/Marlin/src/feature/e_parser.h index 085cbd4eab..0bb0253149 100644 --- a/Marlin/src/feature/e_parser.h +++ b/Marlin/src/feature/e_parser.h @@ -63,6 +63,7 @@ public: }; static bool killed_by_M112; + static bool quickstop_by_M410; #if ENABLED(HOST_PROMPT_SUPPORT) static uint8_t M876_reason; @@ -168,7 +169,7 @@ public: if (enabled) switch (state) { case EP_M108: wait_for_user = wait_for_heatup = false; break; case EP_M112: killed_by_M112 = true; break; - case EP_M410: quickstop_stepper(); break; + case EP_M410: quickstop_by_M410 = true; break; #if ENABLED(HOST_PROMPT_SUPPORT) case EP_M876SN: host_response_handler(M876_reason); break; #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 9ecbb7c766..4b352e738e 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1032,8 +1032,14 @@ void Temperature::manage_heater() { if (!inited) return watchdog_refresh(); #endif - if (TERN0(EMERGENCY_PARSER, emergency_parser.killed_by_M112)) - kill(M112_KILL_STR, nullptr, true); + #if ENABLED(EMERGENCY_PARSER) + if (emergency_parser.killed_by_M112) kill(M112_KILL_STR, nullptr, true); + + if (emergency_parser.quickstop_by_M410) { + emergency_parser.quickstop_by_M410 = false; // quickstop_stepper may call idle so clear this now! + quickstop_stepper(); + } + #endif if (!raw_temps_ready) return;