diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index b40615524..40728fd2c 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'. +// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value. +#define NO_TIMEOUTS 1000 + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +#define ADVANCED_OK + // @section fwretract // Firmware based and LCD controlled retract diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index ed57d2b9c..5517b8e18 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -733,8 +733,20 @@ void get_command() { if (drain_queued_commands_P()) return; // priority is given to non-serial commands + #ifdef NO_TIMEOUTS + static millis_t last_command_time = 0; + millis_t ms = millis(); + + if (!MYSERIAL.available() && commands_in_queue == 0 && ms - last_command_time > NO_TIMEOUTS) { + SERIAL_ECHOLNPGM(MSG_WAIT); + last_command_time = ms; + } + #endif + while (MYSERIAL.available() > 0 && commands_in_queue < BUFSIZE) { - + #ifdef NO_TIMEOUTS + last_command_time = ms; + #endif serial_char = MYSERIAL.read(); if (serial_char == '\n' || serial_char == '\r' || @@ -5523,7 +5535,12 @@ void ClearToSend() { #ifdef SDSUPPORT if (fromsd[cmd_queue_index_r]) return; #endif - SERIAL_PROTOCOLLNPGM(MSG_OK); + SERIAL_PROTOCOLPGM(MSG_OK); + #ifdef ADVANCED_OK + SERIAL_PROTOCOLPGM(" N"); SERIAL_PROTOCOL(gcode_LastN); + SERIAL_PROTOCOLPGM(" P"); SERIAL_PROTOCOL(BUFSIZE - commands_in_queue); + #endif + SERIAL_EOL; } void get_coordinates() { diff --git a/Marlin/configurator/config/Configuration_adv.h b/Marlin/configurator/config/Configuration_adv.h index b40615524..40728fd2c 100644 --- a/Marlin/configurator/config/Configuration_adv.h +++ b/Marlin/configurator/config/Configuration_adv.h @@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'. +// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value. +#define NO_TIMEOUTS 1000 + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +#define ADVANCED_OK + // @section fwretract // Firmware based and LCD controlled retract diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 9384ed553..9fefd05b2 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'. +// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value. +#define NO_TIMEOUTS 1000 + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +#define ADVANCED_OK + // @section fwretract // Firmware based and LCD controlled retract diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 58159fe36..765a098e3 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -377,7 +377,15 @@ const unsigned int dropsegments=5; //everything with less than this number of st //The ASCII buffer for receiving from the serial: #define MAX_CMD_SIZE 96 -#define BUFSIZE 5 +#define BUFSIZE 4 + +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'. +// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value. +#define NO_TIMEOUTS 1000 + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +#define ADVANCED_OK // @section fwretract diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 9384ed553..9fefd05b2 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'. +// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value. +#define NO_TIMEOUTS 1000 + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +#define ADVANCED_OK + // @section fwretract // Firmware based and LCD controlled retract diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 146e7fab1..49aef0933 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'. +// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value. +#define NO_TIMEOUTS 1000 + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +#define ADVANCED_OK + // @section fwretract // Firmware based and LCD controlled retract diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index a4d8f65f9..004a9161c 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -377,7 +377,15 @@ const unsigned int dropsegments=5; //everything with less than this number of st //The ASCII buffer for receiving from the serial: #define MAX_CMD_SIZE 96 -#define BUFSIZE 5 +#define BUFSIZE 4 + +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'. +// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value. +#define NO_TIMEOUTS 1000 + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +#define ADVANCED_OK // @section fwretract diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index 0807c999b..a9e811d84 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -380,6 +380,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'. +// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value. +#define NO_TIMEOUTS 1000 + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +#define ADVANCED_OK + // @section fwretract // Firmware based and LCD controlled retract diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 9f1fda4a4..8665b0303 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -380,6 +380,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'. +// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value. +#define NO_TIMEOUTS 1000 + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +#define ADVANCED_OK + // @section fwretract // Firmware based and LCD controlled retract diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index b36e8a0f3..912c886c0 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'. +// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value. +#define NO_TIMEOUTS 1000 + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +#define ADVANCED_OK + // @section fwretract // Firmware based and LCD controlled retract diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 411985f79..dfbb19381 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'. +// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value. +#define NO_TIMEOUTS 1000 + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +#define ADVANCED_OK + // @section fwretract // Firmware based and LCD controlled retract diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 572fdb6bf..d708d0f25 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'. +// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value. +#define NO_TIMEOUTS 1000 + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +#define ADVANCED_OK + // @section fwretract // Firmware based and LCD controlled retract diff --git a/Marlin/language.h b/Marlin/language.h index 40d8dbe66..789b98c67 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -122,6 +122,7 @@ #define MSG_FREE_MEMORY " Free Memory: " #define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: " #define MSG_OK "ok" +#define MSG_WAIT "wait" #define MSG_FILE_SAVED "Done saving file." #define MSG_ERR_LINE_NO "Line Number is not Last Line Number+1, Last Line: " #define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: "