Skip to content

Commit a2babb5

Browse files
authored
Merge pull request #7217 from benlye/add-kill-action
Add configurable action command to send when printer is killed
2 parents b8066fb + c28749a commit a2babb5

27 files changed

+186
-0
lines changed

Marlin/Configuration_adv.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,13 @@
12681268
#define USER_GCODE_5 "G28\nM503"
12691269
#endif
12701270

1271+
/**
1272+
* Specify an action command to send to the host when the printer is killed.
1273+
* Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'.
1274+
* The host must be configured to handle the action command.
1275+
*/
1276+
//#define ACTION_ON_KILL "poweroff"
1277+
12711278
//===========================================================================
12721279
//====================== I2C Position Encoder Settings ======================
12731280
//===========================================================================

Marlin/Marlin_main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12839,6 +12839,10 @@ void kill(const char* lcd_msg) {
1283912839
_delay_ms(250); //Wait to ensure all interrupts routines stopped
1284012840
thermalManager.disable_all_heaters(); //turn off heaters again
1284112841

12842+
#if defined(ACTION_ON_KILL)
12843+
SERIAL_ECHOLNPGM("//action:" ACTION_ON_KILL);
12844+
#endif
12845+
1284212846
#if HAS_POWER_SWITCH
1284312847
SET_INPUT(PS_ON_PIN);
1284412848
#endif

Marlin/example_configurations/Anet/A6/Configuration_adv.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,13 @@
12681268
#define USER_GCODE_5 "G28\nM503"
12691269
#endif
12701270

1271+
/**
1272+
* Specify an action command to send to the host when the printer is killed.
1273+
* Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'.
1274+
* The host must be configured to handle the action command.
1275+
*/
1276+
//#define ACTION_ON_KILL "poweroff"
1277+
12711278
//===========================================================================
12721279
//====================== I2C Position Encoder Settings ======================
12731280
//===========================================================================

Marlin/example_configurations/Anet/A8/Configuration_adv.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,13 @@
12681268
#define USER_GCODE_5 "G28\nM503"
12691269
#endif
12701270

1271+
/**
1272+
* Specify an action command to send to the host when the printer is killed.
1273+
* Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'.
1274+
* The host must be configured to handle the action command.
1275+
*/
1276+
//#define ACTION_ON_KILL "poweroff"
1277+
12711278
//===========================================================================
12721279
//====================== I2C Position Encoder Settings ======================
12731280
//===========================================================================

Marlin/example_configurations/Cartesio/Configuration_adv.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,13 @@
12611261
#define USER_GCODE_5 "G28\nM503"
12621262
#endif
12631263

1264+
/**
1265+
* Specify an action command to send to the host when the printer is killed.
1266+
* Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'.
1267+
* The host must be configured to handle the action command.
1268+
*/
1269+
//#define ACTION_ON_KILL "poweroff"
1270+
12641271
//===========================================================================
12651272
//====================== I2C Position Encoder Settings ======================
12661273
//===========================================================================

Marlin/example_configurations/Felix/Configuration_adv.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,13 @@
12611261
//#define USER_GCODE_5 "G28\nM503"
12621262
#endif
12631263

1264+
/**
1265+
* Specify an action command to send to the host when the printer is killed.
1266+
* Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'.
1267+
* The host must be configured to handle the action command.
1268+
*/
1269+
//#define ACTION_ON_KILL "poweroff"
1270+
12641271
//===========================================================================
12651272
//====================== I2C Position Encoder Settings ======================
12661273
//===========================================================================

Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,13 @@
12741274
//#define USER_GCODE_5 "G28\nM503"
12751275
#endif
12761276

1277+
/**
1278+
* Specify an action command to send to the host when the printer is killed.
1279+
* Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'.
1280+
* The host must be configured to handle the action command.
1281+
*/
1282+
//#define ACTION_ON_KILL "poweroff"
1283+
12771284
//===========================================================================
12781285
//====================== I2C Position Encoder Settings ======================
12791286
//===========================================================================

Marlin/example_configurations/Hephestos/Configuration_adv.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,13 @@
12611261
//#define USER_GCODE_5 "G28\nM503"
12621262
#endif
12631263

1264+
/**
1265+
* Specify an action command to send to the host when the printer is killed.
1266+
* Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'.
1267+
* The host must be configured to handle the action command.
1268+
*/
1269+
//#define ACTION_ON_KILL "poweroff"
1270+
12641271
//===========================================================================
12651272
//====================== I2C Position Encoder Settings ======================
12661273
//===========================================================================

Marlin/example_configurations/Hephestos_2/Configuration_adv.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,13 @@
12441244
//#define USER_GCODE_5 "G28\nM503"
12451245
#endif
12461246

1247+
/**
1248+
* Specify an action command to send to the host when the printer is killed.
1249+
* Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'.
1250+
* The host must be configured to handle the action command.
1251+
*/
1252+
//#define ACTION_ON_KILL "poweroff"
1253+
12471254
//===========================================================================
12481255
//====================== I2C Position Encoder Settings ======================
12491256
//===========================================================================

Marlin/example_configurations/K8200/Configuration_adv.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,13 @@
12741274
//#define USER_GCODE_5 "G28\nM503"
12751275
#endif
12761276

1277+
/**
1278+
* Specify an action command to send to the host when the printer is killed.
1279+
* Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'.
1280+
* The host must be configured to handle the action command.
1281+
*/
1282+
//#define ACTION_ON_KILL "poweroff"
1283+
12771284
//===========================================================================
12781285
//====================== I2C Position Encoder Settings ======================
12791286
//===========================================================================

0 commit comments

Comments
 (0)