Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse safety commands even with e parser #26944

Open
wants to merge 4 commits into
base: bugfix-2.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Marlin/src/feature/e_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class EmergencyParser {

static void update(State &state, const uint8_t c);

private:
static bool enabled;
InsanityAutomation marked this conversation as resolved.
Show resolved Hide resolved
};

Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/gcode/control/M108_M112_M410.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
*/

#include "../../inc/MarlinConfig.h"

#if DISABLED(EMERGENCY_PARSER)

#include "../gcode.h"
#include "../../MarlinCore.h" // for wait_for_heatup, kill, M112_KILL_STR
#include "../../module/motion.h" // for quickstop_stepper
Expand Down Expand Up @@ -53,4 +50,3 @@ void GcodeSuite::M410() {
quickstop_stepper();
}

#endif // !EMERGENCY_PARSER
16 changes: 5 additions & 11 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,17 +585,11 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 110: M110(); break; // M110: Set Current Line Number
case 111: M111(); break; // M111: Set debug level

#if DISABLED(EMERGENCY_PARSER)
case 108: M108(); break; // M108: Cancel Waiting
case 112: M112(); break; // M112: Full Shutdown
case 410: M410(); break; // M410: Quickstop - Abort all the planned moves.
#if ENABLED(HOST_PROMPT_SUPPORT)
case 876: M876(); break; // M876: Handle Host prompt responses
#endif
#else
case 108: case 112: case 410:
TERN_(HOST_PROMPT_SUPPORT, case 876:)
break;
case 108: M108(); break; // M108: Cancel Waiting
case 112: M112(); break; // M112: Full Shutdown
case 410: M410(); break; // M410: Quickstop - Abort all the planned moves.
#if ENABLED(HOST_PROMPT_SUPPORT)
case 876: M876(); break; // M876: Handle Host prompt responses
#endif

#if ENABLED(HOST_KEEPALIVE_FEATURE)
Expand Down
12 changes: 5 additions & 7 deletions Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -751,13 +751,11 @@ class GcodeSuite {
static void M107();
#endif

#if DISABLED(EMERGENCY_PARSER)
static void M108();
static void M112();
static void M410();
#if ENABLED(HOST_PROMPT_SUPPORT)
static void M876();
#endif
static void M108();
static void M112();
static void M410();
#if ENABLED(HOST_PROMPT_SUPPORT)
static void M876();
#endif

static void M110();
Expand Down
7 changes: 5 additions & 2 deletions Marlin/src/gcode/host/M876.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

#if HAS_GCODE_M876

#if ENABLED(EMERGENCY_PARSER)
#include "../../feature/e_parser.h"
#endif
#include "../../feature/host_actions.h"
#include "../gcode.h"
#include "../../MarlinCore.h"
Expand All @@ -32,8 +35,8 @@
* M876: Handle Prompt Response
*/
void GcodeSuite::M876() {

if (parser.seenval('S')) hostui.handle_response((uint8_t)parser.value_int());
if(TERN1(EMERGENCY_PARSER, emergency_parser.enabled))
if (parser.seenval('S')) hostui.handle_response((uint8_t)parser.value_int());

}

Expand Down
14 changes: 6 additions & 8 deletions Marlin/src/gcode/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,12 @@ void GCodeQueue::get_serial_commands() {
}
}

#if DISABLED(EMERGENCY_PARSER)
// Process critical commands early
if (command[0] == 'M') switch (command[3]) {
case '8': if (command[2] == '0' && command[1] == '1') { wait_for_heatup = false; TERN_(HAS_MARLINUI_MENU, wait_for_user = false); } break;
case '2': if (command[2] == '1' && command[1] == '1') kill(FPSTR(M112_KILL_STR), nullptr, true); break;
case '0': if (command[1] == '4' && command[2] == '1') quickstop_stepper(); break;
}
#endif
// Process critical commands early
if (command[0] == 'M') switch (command[3]) {
case '8': if (command[2] == '0' && command[1] == '1') { wait_for_heatup = false; TERN_(HAS_MARLINUI_MENU, wait_for_user = false); } break;
case '2': if (command[2] == '1' && command[1] == '1') kill(FPSTR(M112_KILL_STR), nullptr, true); break;
case '0': if (command[1] == '4' && command[2] == '1') quickstop_stepper(); break;
}

#if NO_TIMEOUTS > 0
last_command_time = ms;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@
#undef SERIAL_XON_XOFF
#endif

#if ENABLED(HOST_PROMPT_SUPPORT) && DISABLED(EMERGENCY_PARSER)
#if ENABLED(HOST_PROMPT_SUPPORT)
#define HAS_GCODE_M876 1
#endif

Expand Down
2 changes: 1 addition & 1 deletion ini/features.ini
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ USE_CONTROLLER_FAN = build_src_filter=+<src/feature/controll
HAS_COOLER|LASER_COOLANT_FLOW_METER = build_src_filter=+<src/feature/cooler.cpp>
HAS_MOTOR_CURRENT_DAC = build_src_filter=+<src/feature/dac>
DIRECT_STEPPING = build_src_filter=+<src/feature/direct_stepping.cpp> +<src/gcode/motion/G6.cpp>
EMERGENCY_PARSER = build_src_filter=+<src/feature/e_parser.cpp> -<src/gcode/control/M108_*.cpp>
EMERGENCY_PARSER = build_src_filter=+<src/feature/e_parser.cpp>
EASYTHREED_UI = build_src_filter=+<src/feature/easythreed_ui.cpp>
I2C_POSITION_ENCODERS = build_src_filter=+<src/feature/encoder_i2c.cpp>
IIC_BL24CXX_EEPROM = build_src_filter=+<src/libs/BL24CXX.cpp>
Expand Down