Optimize emergency parser check

This commit is contained in:
Scott Lahteine 2020-11-25 22:28:42 -06:00
parent 7ce675e604
commit 3ba374a29e

View file

@ -538,12 +538,11 @@ void GCodeQueue::get_serial_commands() {
#if DISABLED(EMERGENCY_PARSER)
// Process critical commands early
if (strcmp_P(command, PSTR("M108")) == 0) {
wait_for_heatup = false;
TERN_(HAS_LCD_MENU, wait_for_user = false);
if (command[0] == 'M') switch (command[3]) {
case '8': if (command[2] == '0' && command[1] == '1') { wait_for_heatup = false; TERN_(HAS_LCD_MENU, wait_for_user = false); } break;
case '2': if (command[2] == '1' && command[1] == '1') kill(M112_KILL_STR, nullptr, true); break;
case '0': if (command[1] == '4' && command[2] == '1') quickstop_stepper(); break;
}
if (strcmp_P(command, PSTR("M112")) == 0) kill(M112_KILL_STR, nullptr, true);
if (strcmp_P(command, PSTR("M410")) == 0) quickstop_stepper();
#endif
#if defined(NO_TIMEOUTS) && NO_TIMEOUTS > 0