Procházet zdrojové kódy

Merge pull request #1922 from Wurstnase/serial_wait

Serial wait
Scott Lahteine před 10 roky
rodič
revize
8a0dc4d54a

+ 8
- 0
Marlin/Configuration_adv.h Zobrazit soubor

@@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st
379 379
 #define MAX_CMD_SIZE 96
380 380
 #define BUFSIZE 4
381 381
 
382
+// Bad Serial-connections can miss a received command by sending an 'ok'
383
+// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'.
384
+// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value.
385
+#define NO_TIMEOUTS 1000
386
+
387
+// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
388
+#define ADVANCED_OK
389
+
382 390
 // @section fwretract
383 391
 
384 392
 // Firmware based and LCD controlled retract

+ 19
- 2
Marlin/Marlin_main.cpp Zobrazit soubor

@@ -733,8 +733,20 @@ void get_command() {
733 733
 
734 734
   if (drain_queued_commands_P()) return; // priority is given to non-serial commands
735 735
   
736
+  #ifdef NO_TIMEOUTS
737
+    static millis_t last_command_time = 0;
738
+    millis_t ms = millis();
739
+  
740
+    if (!MYSERIAL.available() && commands_in_queue == 0 && ms - last_command_time > NO_TIMEOUTS) {
741
+      SERIAL_ECHOLNPGM(MSG_WAIT);
742
+      last_command_time = ms;
743
+    }
744
+  #endif
745
+  
736 746
   while (MYSERIAL.available() > 0 && commands_in_queue < BUFSIZE) {
737
-
747
+    #ifdef NO_TIMEOUTS
748
+      last_command_time = ms;
749
+    #endif
738 750
     serial_char = MYSERIAL.read();
739 751
 
740 752
     if (serial_char == '\n' || serial_char == '\r' ||
@@ -5523,7 +5535,12 @@ void ClearToSend() {
5523 5535
   #ifdef SDSUPPORT
5524 5536
     if (fromsd[cmd_queue_index_r]) return;
5525 5537
   #endif
5526
-  SERIAL_PROTOCOLLNPGM(MSG_OK);
5538
+  SERIAL_PROTOCOLPGM(MSG_OK);
5539
+  #ifdef ADVANCED_OK
5540
+    SERIAL_PROTOCOLPGM(" N"); SERIAL_PROTOCOL(gcode_LastN);
5541
+    SERIAL_PROTOCOLPGM(" P"); SERIAL_PROTOCOL(BUFSIZE - commands_in_queue);
5542
+  #endif
5543
+  SERIAL_EOL;  
5527 5544
 }
5528 5545
 
5529 5546
 void get_coordinates() {

+ 8
- 0
Marlin/configurator/config/Configuration_adv.h Zobrazit soubor

@@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st
379 379
 #define MAX_CMD_SIZE 96
380 380
 #define BUFSIZE 4
381 381
 
382
+// Bad Serial-connections can miss a received command by sending an 'ok'
383
+// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'.
384
+// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value.
385
+#define NO_TIMEOUTS 1000
386
+
387
+// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
388
+#define ADVANCED_OK
389
+
382 390
 // @section fwretract
383 391
 
384 392
 // Firmware based and LCD controlled retract

+ 8
- 0
Marlin/example_configurations/Felix/Configuration_adv.h Zobrazit soubor

@@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st
379 379
 #define MAX_CMD_SIZE 96
380 380
 #define BUFSIZE 4
381 381
 
382
+// Bad Serial-connections can miss a received command by sending an 'ok'
383
+// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'.
384
+// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value.
385
+#define NO_TIMEOUTS 1000
386
+
387
+// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
388
+#define ADVANCED_OK
389
+
382 390
 // @section fwretract
383 391
 
384 392
 // Firmware based and LCD controlled retract

+ 9
- 1
Marlin/example_configurations/Hephestos/Configuration_adv.h Zobrazit soubor

@@ -377,7 +377,15 @@ const unsigned int dropsegments=5; //everything with less than this number of st
377 377
 
378 378
 //The ASCII buffer for receiving from the serial:
379 379
 #define MAX_CMD_SIZE 96
380
-#define BUFSIZE 5
380
+#define BUFSIZE 4
381
+
382
+// Bad Serial-connections can miss a received command by sending an 'ok'
383
+// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'.
384
+// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value.
385
+#define NO_TIMEOUTS 1000
386
+
387
+// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
388
+#define ADVANCED_OK
381 389
 
382 390
 // @section fwretract
383 391
 

+ 8
- 0
Marlin/example_configurations/K8200/Configuration_adv.h Zobrazit soubor

@@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st
379 379
 #define MAX_CMD_SIZE 96
380 380
 #define BUFSIZE 4
381 381
 
382
+// Bad Serial-connections can miss a received command by sending an 'ok'
383
+// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'.
384
+// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value.
385
+#define NO_TIMEOUTS 1000
386
+
387
+// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
388
+#define ADVANCED_OK
389
+
382 390
 // @section fwretract
383 391
 
384 392
 // Firmware based and LCD controlled retract

+ 8
- 0
Marlin/example_configurations/SCARA/Configuration_adv.h Zobrazit soubor

@@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st
379 379
 #define MAX_CMD_SIZE 96
380 380
 #define BUFSIZE 4
381 381
 
382
+// Bad Serial-connections can miss a received command by sending an 'ok'
383
+// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'.
384
+// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value.
385
+#define NO_TIMEOUTS 1000
386
+
387
+// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
388
+#define ADVANCED_OK
389
+
382 390
 // @section fwretract
383 391
 
384 392
 // Firmware based and LCD controlled retract

+ 9
- 1
Marlin/example_configurations/WITBOX/Configuration_adv.h Zobrazit soubor

@@ -377,7 +377,15 @@ const unsigned int dropsegments=5; //everything with less than this number of st
377 377
 
378 378
 //The ASCII buffer for receiving from the serial:
379 379
 #define MAX_CMD_SIZE 96
380
-#define BUFSIZE 5
380
+#define BUFSIZE 4
381
+
382
+// Bad Serial-connections can miss a received command by sending an 'ok'
383
+// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'.
384
+// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value.
385
+#define NO_TIMEOUTS 1000
386
+
387
+// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
388
+#define ADVANCED_OK
381 389
 
382 390
 // @section fwretract
383 391
 

+ 8
- 0
Marlin/example_configurations/delta/biv2.5/Configuration_adv.h Zobrazit soubor

@@ -380,6 +380,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st
380 380
 #define MAX_CMD_SIZE 96
381 381
 #define BUFSIZE 4
382 382
 
383
+// Bad Serial-connections can miss a received command by sending an 'ok'
384
+// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'.
385
+// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value.
386
+#define NO_TIMEOUTS 1000
387
+
388
+// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
389
+#define ADVANCED_OK
390
+
383 391
 // @section fwretract
384 392
 
385 393
 // Firmware based and LCD controlled retract

+ 8
- 0
Marlin/example_configurations/delta/generic/Configuration_adv.h Zobrazit soubor

@@ -380,6 +380,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st
380 380
 #define MAX_CMD_SIZE 96
381 381
 #define BUFSIZE 4
382 382
 
383
+// Bad Serial-connections can miss a received command by sending an 'ok'
384
+// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'.
385
+// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value.
386
+#define NO_TIMEOUTS 1000
387
+
388
+// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
389
+#define ADVANCED_OK
390
+
383 391
 // @section fwretract
384 392
 
385 393
 // Firmware based and LCD controlled retract

+ 8
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h Zobrazit soubor

@@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st
379 379
 #define MAX_CMD_SIZE 96
380 380
 #define BUFSIZE 4
381 381
 
382
+// Bad Serial-connections can miss a received command by sending an 'ok'
383
+// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'.
384
+// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value.
385
+#define NO_TIMEOUTS 1000
386
+
387
+// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
388
+#define ADVANCED_OK
389
+
382 390
 // @section fwretract
383 391
 
384 392
 // Firmware based and LCD controlled retract

+ 8
- 0
Marlin/example_configurations/makibox/Configuration_adv.h Zobrazit soubor

@@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st
379 379
 #define MAX_CMD_SIZE 96
380 380
 #define BUFSIZE 4
381 381
 
382
+// Bad Serial-connections can miss a received command by sending an 'ok'
383
+// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'.
384
+// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value.
385
+#define NO_TIMEOUTS 1000
386
+
387
+// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
388
+#define ADVANCED_OK
389
+
382 390
 // @section fwretract
383 391
 
384 392
 // Firmware based and LCD controlled retract

+ 8
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h Zobrazit soubor

@@ -379,6 +379,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st
379 379
 #define MAX_CMD_SIZE 96
380 380
 #define BUFSIZE 4
381 381
 
382
+// Bad Serial-connections can miss a received command by sending an 'ok'
383
+// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'.
384
+// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value.
385
+#define NO_TIMEOUTS 1000
386
+
387
+// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
388
+#define ADVANCED_OK
389
+
382 390
 // @section fwretract
383 391
 
384 392
 // Firmware based and LCD controlled retract

+ 1
- 0
Marlin/language.h Zobrazit soubor

@@ -122,6 +122,7 @@
122 122
 #define MSG_FREE_MEMORY                     " Free Memory: "
123 123
 #define MSG_PLANNER_BUFFER_BYTES            "  PlannerBufferBytes: "
124 124
 #define MSG_OK                              "ok"
125
+#define MSG_WAIT                            "wait"
125 126
 #define MSG_FILE_SAVED                      "Done saving file."
126 127
 #define MSG_ERR_LINE_NO                     "Line Number is not Last Line Number+1, Last Line: "
127 128
 #define MSG_ERR_CHECKSUM_MISMATCH           "checksum mismatch, Last Line: "

Loading…
Zrušit
Uložit