Skip to content

Commit 8221f5c

Browse files
committed
Require a Kill or Encoder Button
1 parent 5efc6bb commit 8221f5c

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

Marlin/Configuration_adv.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3972,7 +3972,7 @@
39723972
//#define POSTMORTEM_DEBUGGING
39733973

39743974
/**
3975-
* Reset the MCU automatically instead of locking it after a kill
3975+
* Software Reset options
39763976
*/
3977-
//#define SOFT_RESET_ON_KILL
3978-
//#define SOFT_RESET_VIA_SERIAL // 'KILL' and '^X' commands will soft-reset the controller
3977+
//#define SOFT_RESET_VIA_SERIAL // 'KILL' and '^X' commands will soft-reset the controller
3978+
//#define SOFT_RESET_ON_KILL // Use a digital button to soft-reset the controller after KILL

Marlin/src/MarlinCore.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -863,20 +863,23 @@ void minkill(const bool steppers_off/*=false*/) {
863863

864864
TERN_(HAS_SUICIDE, suicide());
865865

866-
#if HAS_KILL
867-
while ( kill_state()) watchdog_refresh(); // Wait for KILL button to be released
868-
while (!kill_state()) watchdog_refresh(); // Wait for KILL button to be pressed
869-
#elif BOTH(HAS_ENCODER_ACTION, SOFT_RESET_ON_KILL)
870-
while (!ui.button_pressed()) watchdog_refresh(); // Wait for a button press
871-
while ( ui.button_pressed()) watchdog_refresh(); // Wait for a button release
872-
#endif
873-
874866
#if EITHER(HAS_KILL, SOFT_RESET_ON_KILL)
867+
868+
// Wait for both KILL and ENC to be released
869+
while (TERN0(HAS_KILL, !kill_state()) || TERN0(SOFT_RESET_ON_KILL, !ui.button_pressed()))
870+
watchdog_refresh();
871+
872+
// Wait for either KILL or ENC press
873+
while (TERN1(HAS_KILL, kill_state()) && TERN1(SOFT_RESET_ON_KILL, ui.button_pressed()))
874+
watchdog_refresh();
875+
876+
// Reboot the board
875877
HAL_reboot();
876-
#endif
877878

878-
#if !HAS_KILL
879-
for (;;) watchdog_refresh(); // Wait for reset
879+
#else
880+
881+
for (;;) watchdog_refresh(); // Wait for RESET button or power-cycle
882+
880883
#endif
881884
}
882885

Marlin/src/inc/SanityCheck.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2208,12 +2208,19 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
22082208
#endif
22092209

22102210
/**
2211-
* emergency-command parser
2211+
* Emergency Command Parser
22122212
*/
22132213
#if ENABLED(EMERGENCY_PARSER) && defined(__AVR__) && defined(USBCON)
22142214
#error "EMERGENCY_PARSER does not work on boards with AT90USB processors (USBCON)."
22152215
#endif
22162216

2217+
/**
2218+
* Software Reset on Kill option
2219+
*/
2220+
#if ENABLED(SOFT_RESET_ON_KILL) && !BUTTON_EXISTS(ENC)
2221+
#error "An encoder button is required or SOFT_RESET_ON_KILL will reset the printer without notice!"
2222+
#endif
2223+
22172224
/**
22182225
* I2C bus
22192226
*/

Marlin/src/lcd/marlinui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "tft_io/touch_calibration.h"
4040
#endif
4141

42-
#if EITHER(HAS_LCD_MENU, ULTIPANEL_FEEDMULTIPLY)
42+
#if ANY(HAS_LCD_MENU, ULTIPANEL_FEEDMULTIPLY, SOFT_RESET_ON_KILL)
4343
#define HAS_ENCODER_ACTION 1
4444
#endif
4545

0 commit comments

Comments
 (0)