new timout/add adv_ok

This commit is contained in:
Wurstnase 2015-04-20 00:22:40 +02:00
parent b09a957fce
commit 92575cecca
2 changed files with 13 additions and 5 deletions

View file

@ -374,9 +374,13 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#define MAX_CMD_SIZE 96 #define MAX_CMD_SIZE 96
#define BUFSIZE 4 #define BUFSIZE 4
// Some Hosts doesn't have a timeout for resend a command. // Bad Serial-connections can miss a received command by sending an 'ok'
// This is a workaround for them. If your printer sometimes stuck and stop printing this could help. // Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'.
// #define NO_TIMEOUTS // 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 should make the NO_TIMEOUTS unnecessary.
// #define ADVANCED_OK
// @section fwretract // @section fwretract

View file

@ -728,7 +728,7 @@ void get_command() {
static millis_t last_command_time = 0; static millis_t last_command_time = 0;
millis_t ms = millis(); millis_t ms = millis();
if (!MYSERIAL.available() && commands_in_queue == 0 && ms - last_command_time > 1000) { if (!MYSERIAL.available() && commands_in_queue == 0 && ms - last_command_time > NO_TIMEOUTS) {
SERIAL_ECHOLNPGM(MSG_WAIT); SERIAL_ECHOLNPGM(MSG_WAIT);
last_command_time = ms; last_command_time = ms;
} }
@ -5299,7 +5299,11 @@ void ClearToSend() {
#ifdef SDSUPPORT #ifdef SDSUPPORT
if (fromsd[cmd_queue_index_r]) return; if (fromsd[cmd_queue_index_r]) return;
#endif #endif
SERIAL_PROTOCOLLNPGM(MSG_OK); SERIAL_PROTOCOLPGM(MSG_OK);
#ifdef ADVANCED_OK
SERIAL_PROTOCOLPGM(" N"); SERIAL_PROTOCOL(gcode_LastN);
SERIAL_PROTOCOLPGM(" S"); SERIAL_PROTOCOLLN(commands_in_queue);
#endif
} }
void get_coordinates() { void get_coordinates() {