Skip to content

Commit 27e1e7f

Browse files
committed
M112 kills steppers in all cases
1 parent c91acad commit 27e1e7f

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

Marlin/src/Marlin.cpp

+9-14
Original file line numberDiff line numberDiff line change
@@ -741,21 +741,12 @@ void idle(
741741
#endif
742742
}
743743

744-
// Kill heaters, job timer, and queue
745-
void kill_activity() {
746-
thermalManager.disable_all_heaters();
747-
stepper.quick_stop();
748-
//queue.stop();
749-
//print_job_timer.stop();
750-
//queue.clear();
751-
}
752-
753744
/**
754745
* Kill all activity and lock the machine.
755746
* After this the machine will need to be reset.
756747
*/
757-
void kill(PGM_P const lcd_msg/*=nullptr*/) {
758-
kill_activity();
748+
void kill(PGM_P const lcd_msg/*=nullptr*/, const bool steppers_off/*=false*/) {
749+
thermalManager.disable_all_heaters();
759750

760751
SERIAL_ERROR_MSG(MSG_ERR_KILLED);
761752

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

772-
minkill();
763+
minkill(steppers_off);
773764
}
774765

775-
void minkill() {
766+
void minkill(const bool steppers_off/*=false*/) {
776767

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

785-
kill_activity();
776+
// Reiterate heaters off
777+
thermalManager.disable_all_heaters();
778+
779+
// Power off all steppers (for M112) or just the E steppers
780+
steppers_off ? disable_all_steppers() : disable_e_steppers();
786781

787782
#if HAS_POWER_SWITCH
788783
PSU_OFF();

Marlin/src/Marlin.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ void disable_e_stepper(const uint8_t e);
322322
void disable_e_steppers();
323323
void disable_all_steppers();
324324

325-
void kill(PGM_P const lcd_msg=nullptr);
326-
void minkill();
325+
void kill(PGM_P const lcd_msg=nullptr, const bool steppers_off=false);
326+
void minkill(const bool steppers_off=false);
327327

328328
void quickstop_stepper();
329329

Marlin/src/gcode/control/M108_M112_M410.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void GcodeSuite::M108() {
4141
* M112: Full Shutdown
4242
*/
4343
void GcodeSuite::M112() {
44-
kill(PSTR("M112 Shutdown"));
44+
kill(PSTR("M112 Shutdown"), true);
4545
}
4646

4747
/**

0 commit comments

Comments
 (0)