From b09a957fcea37019356d4c679eb3d0e74446fe17 Mon Sep 17 00:00:00 2001 From: Wurstnase Date: Thu, 16 Apr 2015 21:42:54 +0200 Subject: [PATCH] make 'wait' optional and mark as workaround --- Marlin/Configuration_adv.h | 4 ++++ Marlin/Marlin_main.cpp | 18 +++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 6478eb923e..c7a3de5f9a 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -374,6 +374,10 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// Some Hosts doesn't have a timeout for resend a command. +// This is a workaround for them. If your printer sometimes stuck and stop printing this could help. +// #define NO_TIMEOUTS + // @section fwretract // Firmware based and LCD controlled retract diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 6cc0120817..9a9fe6086e 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -724,16 +724,20 @@ void get_command() { if (drain_queued_commands_P()) return; // priority is given to non-serial commands - static millis_t last_command_time = 0; - millis_t ms = millis(); + #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 > 1000) { - SERIAL_ECHOLNPGM(MSG_WAIT); - last_command_time = ms; - } + if (!MYSERIAL.available() && commands_in_queue == 0 && ms - last_command_time > 1000) { + SERIAL_ECHOLNPGM(MSG_WAIT); + last_command_time = ms; + } + #endif while (MYSERIAL.available() > 0 && commands_in_queue < BUFSIZE) { - last_command_time = ms; + #ifdef NO_TIMEOUTS + last_command_time = ms; + #endif serial_char = MYSERIAL.read(); if (serial_char == '\n' || serial_char == '\r' ||