diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index b40615524b..40728fd2c3 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 ed57d2b9c8..5517b8e18f 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 b40615524b..40728fd2c3 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 9384ed5536..9fefd05b24 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 58159fe362..765a098e38 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 9384ed5536..9fefd05b24 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 146e7fab14..49aef09335 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 a4d8f65f91..004a9161c0 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 0807c999bf..a9e811d84d 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 9f1fda4a43..8665b03035 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 b36e8a0f38..912c886c04 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 411985f799..dfbb193816 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 572fdb6bf5..d708d0f25b 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 40d8dbe663..789b98c67c 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: "