Skip to content

Commit

Permalink
Handle M410 out of the UART IQR, as other EP commands. Running inside…
Browse files Browse the repository at this point in the history
… an IRQ dont work, because all other IRQ will stay blocked until that code returns, and it will prevent temp timer to run, that M410 depends to finish.
  • Loading branch information
rhapsodyv committed Oct 15, 2020
1 parent f6ffbe5 commit 6bf41f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,12 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
#if HAS_TFT_LVGL_UI
LV_TASK_HANDLER();
#endif

if (TERN0(EMERGENCY_PARSER, emergency_parser.quickstop_by_M410)) {
// quickstop_stepper will call idle, so we must set it to false to avoid infinite loop
emergency_parser.quickstop_by_M410 = false;
quickstop_stepper();
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/feature/e_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

// Static data members
bool EmergencyParser::killed_by_M112, // = false
EmergencyParser::quickstop_by_M410,
EmergencyParser::enabled;

#if ENABLED(HOST_PROMPT_SUPPORT)
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/feature/e_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class EmergencyParser {
};

static bool killed_by_M112;
static bool quickstop_by_M410;

#if ENABLED(HOST_PROMPT_SUPPORT)
static uint8_t M876_reason;
Expand Down Expand Up @@ -168,7 +169,7 @@ class EmergencyParser {
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
Expand Down

0 comments on commit 6bf41f7

Please sign in to comment.