Skip to content

Commit

Permalink
M112 kills steppers in all cases
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 28, 2019
1 parent c91acad commit 27e1e7f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
23 changes: 9 additions & 14 deletions Marlin/src/Marlin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,21 +741,12 @@ void idle(
#endif
}

// Kill heaters, job timer, and queue
void kill_activity() {
thermalManager.disable_all_heaters();
stepper.quick_stop();
//queue.stop();
//print_job_timer.stop();
//queue.clear();
}

/**
* Kill all activity and lock the machine.
* After this the machine will need to be reset.
*/
void kill(PGM_P const lcd_msg/*=nullptr*/) {
kill_activity();
void kill(PGM_P const lcd_msg/*=nullptr*/, const bool steppers_off/*=false*/) {
thermalManager.disable_all_heaters();

SERIAL_ERROR_MSG(MSG_ERR_KILLED);

Expand All @@ -769,10 +760,10 @@ void kill(PGM_P const lcd_msg/*=nullptr*/) {
host_action_kill();
#endif

minkill();
minkill(steppers_off);
}

void minkill() {
void minkill(const bool steppers_off/*=false*/) {

// Wait a short time (allows messages to get out before shutting down.
for (int i = 1000; i--;) DELAY_US(600);
Expand All @@ -782,7 +773,11 @@ void minkill() {
// Wait to ensure all interrupts stopped
for (int i = 1000; i--;) DELAY_US(250);

kill_activity();
// Reiterate heaters off
thermalManager.disable_all_heaters();

// Power off all steppers (for M112) or just the E steppers
steppers_off ? disable_all_steppers() : disable_e_steppers();

#if HAS_POWER_SWITCH
PSU_OFF();
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/Marlin.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ void disable_e_stepper(const uint8_t e);
void disable_e_steppers();
void disable_all_steppers();

void kill(PGM_P const lcd_msg=nullptr);
void minkill();
void kill(PGM_P const lcd_msg=nullptr, const bool steppers_off=false);
void minkill(const bool steppers_off=false);

void quickstop_stepper();

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/control/M108_M112_M410.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void GcodeSuite::M108() {
* M112: Full Shutdown
*/
void GcodeSuite::M112() {
kill(PSTR("M112 Shutdown"));
kill(PSTR("M112 Shutdown"), true);
}

/**
Expand Down

0 comments on commit 27e1e7f

Please sign in to comment.