diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index d2cfff0af..bcae08a0a 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1441,6 +1441,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 2647a5232..4fb4a39f7 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -6497,6 +6497,10 @@ inline void gcode_M17() { ) { if (move_away_flag) return false; // already paused + #ifdef ACTION_ON_PAUSE + SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE); + #endif + if (!DEBUGGING(DRYRUN) && unload_length != 0) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (!thermalManager.allow_cold_extrude && @@ -6729,6 +6733,10 @@ inline void gcode_M17() { lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); #endif + #ifdef ACTION_ON_RESUME + SERIAL_ECHOLNPGM("//action:" ACTION_ON_RESUME); + #endif + #if ENABLED(SDSUPPORT) if (sd_print_paused) { card.startFileprint();