From f704f405af4d9e32d26dfaaf40fd73c604487123 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 25 Dec 2017 01:36:42 -0600 Subject: [PATCH] Add pause/resume actions on M600, M125 --- Marlin/Configuration_adv.h | 8 ++++++++ Marlin/src/feature/pause.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 9347e6c5b..e953fd4e2 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1430,6 +1430,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/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 6322b8958..f41e346ef 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -114,6 +114,10 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u ) { 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 && @@ -342,6 +346,10 @@ void resume_print(const float &load_length/*=0*/, const float &initial_extrude_l 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();