From 5ab0dcb4c58f0abeed210b840c8ffb8d69d5e43a Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Wed, 14 Dec 2022 00:25:38 +0100 Subject: [PATCH] Allow M310 to bypass the Stopped state for recovery Since M310 cannot change the heaters, allowing M310 S0 (and changing parameters) allows to recover a usb-controlled printer which has been locked-out due to bad model settings. --- Firmware/cmdqueue.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Firmware/cmdqueue.cpp b/Firmware/cmdqueue.cpp index 16d0e04c5..93cc792a8 100755 --- a/Firmware/cmdqueue.cpp +++ b/Firmware/cmdqueue.cpp @@ -438,11 +438,16 @@ void get_command() if(strcmp_P(cmd_start, PSTR("M112")) == 0) kill(MSG_M112_KILL, 2); + // Bypass Stopped for some commands + bool allow_when_stopped = false; + if(strncmp_P(cmd_start, PSTR("M310"), 4) == 0) + allow_when_stopped = true; + // Handle the USB timer if ((*cmd_start == 'G') && !IS_SD_PRINTING) usb_timer.start(); - if (Stopped == true) { + if (allow_when_stopped == false && Stopped == true) { // Stopped can be set either during error states (thermal error: cannot continue), or // when a printer-initiated action is processed. In such case the printer will send to // the host an action, but cannot know if the action has been processed while new