Merge pull request #3414 from thinkyhead/rc_host_timeout_mods
Host Keepalive configurable timeout with 2s default
This commit is contained in:
@@ -155,6 +155,7 @@
|
||||
* M110 - Set the current line number
|
||||
* M111 - Set debug flags with S<mask>. 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
|
||||
@@ -456,6 +457,7 @@ static bool send_ok[BUFSIZE];
|
||||
|
||||
static MarlinBusyState busy_state = NOT_BUSY;
|
||||
static millis_t next_busy_signal_ms = -1;
|
||||
uint8_t host_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL;
|
||||
#define KEEPALIVE_STATE(n) do{ busy_state = n; }while(0)
|
||||
#else
|
||||
#define host_keepalive() ;
|
||||
@@ -2297,7 +2299,7 @@ void unknown_command_error() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
next_busy_signal_ms = ms + 10000UL; // "busy: ..." message every 10s
|
||||
next_busy_signal_ms = host_keepalive_interval ? ms + 1000UL * host_keepalive_interval : -1;
|
||||
}
|
||||
|
||||
#endif //HOST_KEEPALIVE_FEATURE
|
||||
@@ -4427,6 +4429,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<seconds> 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
|
||||
|
Reference in New Issue
Block a user