From e0b0d1eb6b476c6180ed08608476c9e2158d0e94 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 6 Apr 2016 17:31:49 -0700 Subject: [PATCH] Add M113 to get/set Host Keepalive --- Marlin/Marlin_main.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 9a1e3ae6c3..0b097d9c75 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -151,6 +151,7 @@ * M110 - Set the current line number * M111 - Set debug flags with S. See flag bits defined in Marlin.h. * M112 - Emergency stop + * M113 - Get or set the timeout interval for Host Keepalive "busy" messages * M114 - Output current position to serial port * M115 - Capabilities string * M117 - Display a message on the controller screen @@ -4385,6 +4386,27 @@ inline void gcode_M111() { */ inline void gcode_M112() { kill(PSTR(MSG_KILLED)); } +#if ENABLED(HOST_KEEPALIVE_FEATURE) + + /** + * M113: Get or set Host Keepalive interval (0 to disable) + * + * S Optional. Set the keepalive interval. + */ + inline void gcode_M113() { + if (code_seen('S')) { + host_keepalive_interval = (uint8_t)code_value_short(); + NOMORE(host_keepalive_interval, 60); + } + else { + SERIAL_ECHO_START; + SERIAL_ECHOPAIR("M113 S", (unsigned long)host_keepalive_interval); + SERIAL_EOL; + } + } + +#endif + #if ENABLED(BARICUDA) #if HAS_HEATER_1