瀏覽代碼

Merge pull request #7459 from ejtagle/xon-xoff-sdxfer

[1.1.x] XON/XOFF serial handshake (for faster transfers to SD)
Scott Lahteine 7 年之前
父節點
當前提交
a47c5c093d
共有 66 個文件被更改,包括 908 次插入123 次删除
  1. 2
    1
      Marlin/Configuration.h
  2. 23
    1
      Marlin/Configuration_adv.h
  3. 197
    60
      Marlin/MarlinSerial.cpp
  4. 29
    23
      Marlin/MarlinSerial.h
  5. 14
    4
      Marlin/Marlin_main.cpp
  6. 2
    1
      Marlin/example_configurations/AlephObjects/TAZ4/Configuration.h
  7. 22
    0
      Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h
  8. 2
    1
      Marlin/example_configurations/AliExpress/CL-260/Configuration.h
  9. 2
    1
      Marlin/example_configurations/Anet/A6/Configuration.h
  10. 22
    0
      Marlin/example_configurations/Anet/A6/Configuration_adv.h
  11. 2
    1
      Marlin/example_configurations/Anet/A8/Configuration.h
  12. 22
    0
      Marlin/example_configurations/Anet/A8/Configuration_adv.h
  13. 2
    1
      Marlin/example_configurations/BQ/Hephestos/Configuration.h
  14. 22
    0
      Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h
  15. 2
    1
      Marlin/example_configurations/BQ/Hephestos_2/Configuration.h
  16. 22
    0
      Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h
  17. 2
    1
      Marlin/example_configurations/BQ/WITBOX/Configuration.h
  18. 22
    0
      Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h
  19. 2
    1
      Marlin/example_configurations/Cartesio/Configuration.h
  20. 22
    0
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  21. 2
    1
      Marlin/example_configurations/Creality/CR-10/Configuration.h
  22. 2
    1
      Marlin/example_configurations/Felix/Configuration.h
  23. 22
    0
      Marlin/example_configurations/Felix/Configuration_adv.h
  24. 2
    1
      Marlin/example_configurations/Felix/DUAL/Configuration.h
  25. 2
    1
      Marlin/example_configurations/Folger Tech/i3-2020/Configuration.h
  26. 22
    0
      Marlin/example_configurations/Folger Tech/i3-2020/Configuration_adv.h
  27. 2
    1
      Marlin/example_configurations/Geeetech/GT2560/Configuration.h
  28. 2
    1
      Marlin/example_configurations/Geeetech/I3_Pro_X-GT2560/Configuration.h
  29. 2
    1
      Marlin/example_configurations/Infitary/i3-M508/Configuration.h
  30. 22
    0
      Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h
  31. 2
    1
      Marlin/example_configurations/Malyan/M150/Configuration.h
  32. 22
    0
      Marlin/example_configurations/Malyan/M150/Configuration_adv.h
  33. 2
    1
      Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
  34. 2
    1
      Marlin/example_configurations/RigidBot/Configuration.h
  35. 22
    0
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  36. 2
    1
      Marlin/example_configurations/SCARA/Configuration.h
  37. 22
    0
      Marlin/example_configurations/SCARA/Configuration_adv.h
  38. 2
    1
      Marlin/example_configurations/TinyBoy2/Configuration.h
  39. 22
    0
      Marlin/example_configurations/TinyBoy2/Configuration_adv.h
  40. 2
    1
      Marlin/example_configurations/Velleman/K8200/Configuration.h
  41. 22
    0
      Marlin/example_configurations/Velleman/K8200/Configuration_adv.h
  42. 2
    1
      Marlin/example_configurations/Velleman/K8400/Configuration.h
  43. 22
    0
      Marlin/example_configurations/Velleman/K8400/Configuration_adv.h
  44. 2
    1
      Marlin/example_configurations/Velleman/K8400/Dual-head/Configuration.h
  45. 2
    1
      Marlin/example_configurations/adafruit/ST7565/Configuration.h
  46. 2
    1
      Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h
  47. 22
    0
      Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h
  48. 2
    1
      Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h
  49. 22
    0
      Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h
  50. 2
    1
      Marlin/example_configurations/delta/generic/Configuration.h
  51. 22
    0
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  52. 2
    1
      Marlin/example_configurations/delta/kossel_mini/Configuration.h
  53. 22
    0
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  54. 2
    1
      Marlin/example_configurations/delta/kossel_pro/Configuration.h
  55. 22
    0
      Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
  56. 2
    1
      Marlin/example_configurations/delta/kossel_xl/Configuration.h
  57. 22
    0
      Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
  58. 2
    1
      Marlin/example_configurations/gCreate/gMax1.5+/Configuration.h
  59. 22
    0
      Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h
  60. 2
    1
      Marlin/example_configurations/makibox/Configuration.h
  61. 22
    0
      Marlin/example_configurations/makibox/Configuration_adv.h
  62. 2
    1
      Marlin/example_configurations/tvrrug/Round2/Configuration.h
  63. 22
    0
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  64. 2
    1
      Marlin/example_configurations/wt150/Configuration.h
  65. 22
    0
      Marlin/example_configurations/wt150/Configuration_adv.h
  66. 3
    0
      Marlin/macros.h

+ 2
- 1
Marlin/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 23
- 1
Marlin/Configuration_adv.h 查看文件

@@ -744,7 +744,7 @@
744 744
 #define MAX_CMD_SIZE 96
745 745
 #define BUFSIZE 4
746 746
 
747
-// Transfer Buffer Size
747
+// Transmission to Host Buffer Size
748 748
 // To save 386 bytes of PROGMEM (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0.
749 749
 // To buffer a simple "ok" you need 4 bytes.
750 750
 // For ADVANCED_OK (M105) you need 32 bytes.
@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 197
- 60
Marlin/MarlinSerial.cpp 查看文件

@@ -27,15 +27,30 @@
27 27
  * Modified 23 November 2006 by David A. Mellis
28 28
  * Modified 28 September 2010 by Mark Sproul
29 29
  * Modified 14 February 2016 by Andreas Hardtung (added tx buffer)
30
+ * Modified 01 October 2017 by Eduardo José Tagle (added XON/XOFF)
30 31
  */
31 32
 
32
-#include "MarlinSerial.h"
33
-#include "Marlin.h"
34
-
35 33
 // Disable HardwareSerial.cpp to support chips without a UART (Attiny, etc.)
36 34
 
35
+#include "MarlinConfig.h"
36
+
37 37
 #if !defined(USBCON) && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H))
38 38
 
39
+  #include "MarlinSerial.h"
40
+  #include "Marlin.h"
41
+
42
+  struct ring_buffer_r {
43
+    unsigned char buffer[RX_BUFFER_SIZE];
44
+    volatile ring_buffer_pos_t head, tail;
45
+  };
46
+
47
+  #if TX_BUFFER_SIZE > 0
48
+    struct ring_buffer_t {
49
+      unsigned char buffer[TX_BUFFER_SIZE];
50
+      volatile uint8_t head, tail;
51
+    };
52
+  #endif
53
+
39 54
   #if UART_PRESENT(SERIAL_PORT)
40 55
     ring_buffer_r rx_buffer = { { 0 }, 0, 0 };
41 56
     #if TX_BUFFER_SIZE > 0
@@ -44,6 +59,23 @@
44 59
     #endif
45 60
   #endif
46 61
 
62
+  #if ENABLED(SERIAL_XON_XOFF)
63
+    uint8_t xon_xoff_state = XON_XOFF_CHAR_SENT | XON_CHAR;
64
+    constexpr uint8_t XON_XOFF_CHAR_SENT = 0x80;  // XON / XOFF Character was sent
65
+    constexpr uint8_t XON_XOFF_CHAR_MASK = 0x1F;  // XON / XOFF character to send
66
+    // XON / XOFF character definitions
67
+    constexpr uint8_t XON_CHAR  = 17;
68
+    constexpr uint8_t XOFF_CHAR = 19;
69
+  #endif
70
+
71
+  #if ENABLED(SERIAL_STATS_DROPPED_RX)
72
+    uint8_t rx_dropped_bytes = 0;
73
+  #endif
74
+
75
+  #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
76
+    ring_buffer_pos_t rx_max_enqueued = 0;
77
+  #endif
78
+
47 79
   #if ENABLED(EMERGENCY_PARSER)
48 80
 
49 81
     #include "stepper.h"
@@ -136,20 +168,78 @@
136 168
 
137 169
   #endif // EMERGENCY_PARSER
138 170
 
139
-  FORCE_INLINE void store_char(unsigned char c) {
140
-    CRITICAL_SECTION_START;
141
-      const uint8_t h = rx_buffer.head,
142
-                    i = (uint8_t)(h + 1) & (RX_BUFFER_SIZE - 1);
143
-
144
-      // if we should be storing the received character into the location
145
-      // just before the tail (meaning that the head would advance to the
146
-      // current location of the tail), we're about to overflow the buffer
147
-      // and so we don't write the character or advance the head.
148
-      if (i != rx_buffer.tail) {
149
-        rx_buffer.buffer[h] = c;
150
-        rx_buffer.head = i;
171
+  FORCE_INLINE void store_rxd_char() {
172
+    const ring_buffer_pos_t h = rx_buffer.head,
173
+                            i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1);
174
+
175
+    // If the character is to be stored at the index just before the tail
176
+    // (such that the head would advance to the current tail), the buffer is
177
+    // critical, so don't write the character or advance the head.
178
+    if (i != rx_buffer.tail) {
179
+      rx_buffer.buffer[h] = M_UDRx;
180
+      rx_buffer.head = i;
181
+    }
182
+    else {
183
+      (void)M_UDRx;
184
+      #if ENABLED(SERIAL_STATS_DROPPED_RX)
185
+        if (!++rx_dropped_bytes) ++rx_dropped_bytes;
186
+      #endif
187
+    }
188
+
189
+    #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
190
+      // calculate count of bytes stored into the RX buffer
191
+      ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(rx_buffer.head - rx_buffer.tail) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1);
192
+      // Keep track of the maximum count of enqueued bytes
193
+      NOLESS(rx_max_enqueued, rx_count);
194
+    #endif
195
+
196
+    #if ENABLED(SERIAL_XON_XOFF)
197
+
198
+      // for high speed transfers, we can use XON/XOFF protocol to do
199
+      // software handshake and avoid overruns.
200
+      if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XON_CHAR) {
201
+
202
+        // calculate count of bytes stored into the RX buffer
203
+        ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(rx_buffer.head - rx_buffer.tail) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1);
204
+
205
+        // if we are above 12.5% of RX buffer capacity, send XOFF before
206
+        // we run out of RX buffer space .. We need 325 bytes @ 250kbits/s to
207
+        // let the host react and stop sending bytes. This translates to 13mS
208
+        // propagation time.
209
+        if (rx_count >= (RX_BUFFER_SIZE) / 8) {
210
+          // If TX interrupts are disabled and data register is empty,
211
+          // just write the byte to the data register and be done. This
212
+          // shortcut helps significantly improve the effective datarate
213
+          // at high (>500kbit/s) bitrates, where interrupt overhead
214
+          // becomes a slowdown.
215
+          if (!TEST(M_UCSRxB, M_UDRIEx) && TEST(M_UCSRxA, M_UDREx)) {
216
+            // Send an XOFF character
217
+            M_UDRx = XOFF_CHAR;
218
+            // clear the TXC bit -- "can be cleared by writing a one to its bit
219
+            // location". This makes sure flush() won't return until the bytes
220
+            // actually got written
221
+            SBI(M_UCSRxA, M_TXCx);
222
+            // And remember it was sent
223
+            xon_xoff_state = XOFF_CHAR | XON_XOFF_CHAR_SENT;
224
+          }
225
+          else {
226
+            // TX interrupts disabled, but buffer still not empty ... or
227
+            // TX interrupts enabled. Reenable TX ints and schedule XOFF
228
+            // character to be sent
229
+            #if TX_BUFFER_SIZE > 0
230
+              SBI(M_UCSRxB, M_UDRIEx);
231
+              xon_xoff_state = XOFF_CHAR;
232
+            #else
233
+              // We are not using TX interrupts, we will have to send this manually
234
+              while (!TEST(M_UCSRxA, M_UDREx)) {/* nada */}
235
+              M_UDRx = XOFF_CHAR;
236
+              // And remember we already sent it
237
+              xon_xoff_state = XOFF_CHAR | XON_XOFF_CHAR_SENT;
238
+            #endif
239
+          }
240
+        }
151 241
       }
152
-    CRITICAL_SECTION_END;
242
+    #endif // SERIAL_XON_XOFF
153 243
 
154 244
     #if ENABLED(EMERGENCY_PARSER)
155 245
       emergency_parser(c);
@@ -160,37 +250,41 @@
160 250
 
161 251
     FORCE_INLINE void _tx_udr_empty_irq(void) {
162 252
       // If interrupts are enabled, there must be more data in the output
163
-      // buffer. Send the next byte
164
-      const uint8_t t = tx_buffer.tail,
165
-                    c = tx_buffer.buffer[t];
166
-      tx_buffer.tail = (t + 1) & (TX_BUFFER_SIZE - 1);
167
-
168
-      M_UDRx = c;
253
+      // buffer.
254
+
255
+      #if ENABLED(SERIAL_XON_XOFF)
256
+        // Do a priority insertion of an XON/XOFF char, if needed.
257
+        const uint8_t state = xon_xoff_state;
258
+        if (!(state & XON_XOFF_CHAR_SENT)) {
259
+          M_UDRx = state & XON_XOFF_CHAR_MASK;
260
+          xon_xoff_state = state | XON_XOFF_CHAR_SENT;
261
+        }
262
+        else
263
+      #endif
264
+      { // Send the next byte
265
+        const uint8_t t = tx_buffer.tail, c = tx_buffer.buffer[t];
266
+        tx_buffer.tail = (t + 1) & (TX_BUFFER_SIZE - 1);
267
+        M_UDRx = c;
268
+      }
169 269
 
170 270
       // clear the TXC bit -- "can be cleared by writing a one to its bit
171 271
       // location". This makes sure flush() won't return until the bytes
172 272
       // actually got written
173 273
       SBI(M_UCSRxA, M_TXCx);
174 274
 
175
-      if (tx_buffer.head == tx_buffer.tail) {
176
-        // Buffer empty, so disable interrupts
275
+      // Disable interrupts if the buffer is empty
276
+      if (tx_buffer.head == tx_buffer.tail)
177 277
         CBI(M_UCSRxB, M_UDRIEx);
178
-      }
179 278
     }
180 279
 
181 280
     #ifdef M_USARTx_UDRE_vect
182
-      ISR(M_USARTx_UDRE_vect) {
183
-        _tx_udr_empty_irq();
184
-      }
281
+      ISR(M_USARTx_UDRE_vect) { _tx_udr_empty_irq(); }
185 282
     #endif
186 283
 
187 284
   #endif // TX_BUFFER_SIZE
188 285
 
189 286
   #ifdef M_USARTx_RX_vect
190
-    ISR(M_USARTx_RX_vect) {
191
-      const unsigned char c = M_UDRx;
192
-      store_char(c);
193
-    }
287
+    ISR(M_USARTx_RX_vect) { store_rxd_char(); }
194 288
   #endif
195 289
 
196 290
   // Public Methods
@@ -200,9 +294,9 @@
200 294
     bool useU2X = true;
201 295
 
202 296
     #if F_CPU == 16000000UL && SERIAL_PORT == 0
203
-      // hard-coded exception for compatibility with the bootloader shipped
204
-      // with the Duemilanove and previous boards and the firmware on the 8U2
205
-      // on the Uno and Mega 2560.
297
+      // Hard-coded exception for compatibility with the bootloader shipped
298
+      // with the Duemilanove and previous boards, and the firmware on the
299
+      // 8U2 on the Uno and Mega 2560.
206 300
       if (baud == 57600) useU2X = false;
207 301
     #endif
208 302
 
@@ -237,8 +331,9 @@
237 331
 
238 332
   void MarlinSerial::checkRx(void) {
239 333
     if (TEST(M_UCSRxA, M_RXCx)) {
240
-      const uint8_t c = M_UDRx;
241
-      store_char(c);
334
+      CRITICAL_SECTION_START;
335
+        store_rxd_char();
336
+      CRITICAL_SECTION_END;
242 337
     }
243 338
   }
244 339
 
@@ -252,51 +347,81 @@
252 347
   int MarlinSerial::read(void) {
253 348
     int v;
254 349
     CRITICAL_SECTION_START;
255
-      const uint8_t t = rx_buffer.tail;
350
+      const ring_buffer_pos_t t = rx_buffer.tail;
256 351
       if (rx_buffer.head == t)
257 352
         v = -1;
258 353
       else {
259 354
         v = rx_buffer.buffer[t];
260
-        rx_buffer.tail = (uint8_t)(t + 1) & (RX_BUFFER_SIZE - 1);
355
+        rx_buffer.tail = (ring_buffer_pos_t)(t + 1) & (RX_BUFFER_SIZE - 1);
356
+
357
+        #if ENABLED(SERIAL_XON_XOFF)
358
+          if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XOFF_CHAR) {
359
+            // Get count of bytes in the RX buffer
360
+            ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(rx_buffer.head - rx_buffer.tail) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1);
361
+            // When below 10% of RX buffer capacity, send XON before
362
+            // running out of RX buffer bytes
363
+            if (rx_count < (RX_BUFFER_SIZE) / 10) {
364
+              xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT;
365
+              CRITICAL_SECTION_END;       // End critical section before returning!
366
+              writeNoHandshake(XON_CHAR);
367
+              return v;
368
+            }
369
+          }
370
+        #endif
261 371
       }
262 372
     CRITICAL_SECTION_END;
263 373
     return v;
264 374
   }
265 375
 
266
-  uint8_t MarlinSerial::available(void) {
376
+  ring_buffer_pos_t MarlinSerial::available(void) {
267 377
     CRITICAL_SECTION_START;
268
-      const uint8_t h = rx_buffer.head,
269
-                    t = rx_buffer.tail;
378
+      const ring_buffer_pos_t h = rx_buffer.head, t = rx_buffer.tail;
270 379
     CRITICAL_SECTION_END;
271
-    return (uint8_t)(RX_BUFFER_SIZE + h - t) & (RX_BUFFER_SIZE - 1);
380
+    return (ring_buffer_pos_t)(RX_BUFFER_SIZE + h - t) & (RX_BUFFER_SIZE - 1);
272 381
   }
273 382
 
274 383
   void MarlinSerial::flush(void) {
275
-    // RX
276
-    // don't reverse this or there may be problems if the RX interrupt
277
-    // occurs after reading the value of rx_buffer_head but before writing
278
-    // the value to rx_buffer_tail; the previous value of rx_buffer_head
279
-    // may be written to rx_buffer_tail, making it appear as if the buffer
280
-    // were full, not empty.
384
+    // Don't change this order of operations. If the RX interrupt occurs between
385
+    // reading rx_buffer_head and updating rx_buffer_tail, the previous rx_buffer_head
386
+    // may be written to rx_buffer_tail, making the buffer appear full rather than empty.
281 387
     CRITICAL_SECTION_START;
282 388
       rx_buffer.head = rx_buffer.tail;
283 389
     CRITICAL_SECTION_END;
390
+
391
+    #if ENABLED(SERIAL_XON_XOFF)
392
+      if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XOFF_CHAR) {
393
+        xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT;
394
+        writeNoHandshake(XON_CHAR);
395
+      }
396
+    #endif
284 397
   }
285 398
 
286 399
   #if TX_BUFFER_SIZE > 0
287 400
     uint8_t MarlinSerial::availableForWrite(void) {
288 401
       CRITICAL_SECTION_START;
289
-        const uint8_t h = tx_buffer.head,
290
-                      t = tx_buffer.tail;
402
+        const uint8_t h = tx_buffer.head, t = tx_buffer.tail;
291 403
       CRITICAL_SECTION_END;
292 404
       return (uint8_t)(TX_BUFFER_SIZE + h - t) & (TX_BUFFER_SIZE - 1);
293 405
     }
294 406
 
295 407
     void MarlinSerial::write(const uint8_t c) {
408
+      #if ENABLED(SERIAL_XON_XOFF)
409
+        const uint8_t state = xon_xoff_state;
410
+        if (!(state & XON_XOFF_CHAR_SENT)) {
411
+          // Send 2 chars: XON/XOFF, then a user-specified char
412
+          writeNoHandshake(state & XON_XOFF_CHAR_MASK);
413
+          xon_xoff_state = state | XON_XOFF_CHAR_SENT;
414
+        }
415
+      #endif
416
+      writeNoHandshake(c);
417
+    }
418
+
419
+    void MarlinSerial::writeNoHandshake(const uint8_t c) {
296 420
       _written = true;
297 421
       CRITICAL_SECTION_START;
298 422
         bool emty = (tx_buffer.head == tx_buffer.tail);
299 423
       CRITICAL_SECTION_END;
424
+
300 425
       // If the buffer and the data register is empty, just write the byte
301 426
       // to the data register and be done. This shortcut helps
302 427
       // significantly improve the effective datarate at high (>
@@ -353,20 +478,32 @@
353 478
       }
354 479
       // If we get here, nothing is queued anymore (DRIE is disabled) and
355 480
       // the hardware finished tranmission (TXC is set).
356
-  }
481
+    }
357 482
 
358
-  #else
359
-    void MarlinSerial::write(uint8_t c) {
360
-      while (!TEST(M_UCSRxA, M_UDREx))
361
-        ;
362
-      M_UDRx = c;
483
+  #else // TX_BUFFER_SIZE == 0
484
+
485
+    void MarlinSerial::write(const uint8_t c) {
486
+      #if ENABLED(SERIAL_XON_XOFF)
487
+        // Do a priority insertion of an XON/XOFF char, if needed.
488
+        const uint8_t state = xon_xoff_state;
489
+        if (!(state & XON_XOFF_CHAR_SENT)) {
490
+          writeNoHandshake(state & XON_XOFF_CHAR_MASK);
491
+          xon_xoff_state = state | XON_XOFF_CHAR_SENT;
492
+        }
493
+      #endif
494
+      writeNoHandshake(c);
363 495
     }
364
-  #endif
365 496
 
366
-  // end NEW
497
+    void MarlinSerial::writeNoHandshake(uint8_t c) {
498
+      while (!TEST(M_UCSRxA, M_UDREx)) {/* nada */}
499
+      M_UDRx = c;
500
+    }
367 501
 
368
-  /// imports from print.h
502
+  #endif // TX_BUFFER_SIZE == 0
369 503
 
504
+  /**
505
+   * Imports from print.h
506
+   */
370 507
 
371 508
   void MarlinSerial::print(char c, int base) {
372 509
     print((long)c, base);

+ 29
- 23
Marlin/MarlinSerial.h 查看文件

@@ -87,34 +87,31 @@
87 87
   #ifndef TX_BUFFER_SIZE
88 88
     #define TX_BUFFER_SIZE 32
89 89
   #endif
90
-  #if !((RX_BUFFER_SIZE == 256) ||(RX_BUFFER_SIZE == 128) ||(RX_BUFFER_SIZE == 64) ||(RX_BUFFER_SIZE == 32) ||(RX_BUFFER_SIZE == 16) ||(RX_BUFFER_SIZE == 8) ||(RX_BUFFER_SIZE == 4) ||(RX_BUFFER_SIZE == 2))
91
-    #error "RX_BUFFER_SIZE has to be a power of 2 and >= 2"
90
+
91
+  #if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
92
+    #error "XON/XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
92 93
   #endif
93
-  #if !((TX_BUFFER_SIZE == 256) ||(TX_BUFFER_SIZE == 128) ||(TX_BUFFER_SIZE == 64) ||(TX_BUFFER_SIZE == 32) ||(TX_BUFFER_SIZE == 16) ||(TX_BUFFER_SIZE == 8) ||(TX_BUFFER_SIZE == 4) ||(TX_BUFFER_SIZE == 2) ||(TX_BUFFER_SIZE == 0))
94
-    #error TX_BUFFER_SIZE has to be a power of 2 or 0
94
+  #if !IS_POWER_OF_2(RX_BUFFER_SIZE) || RX_BUFFER_SIZE < 2
95
+    #error "RX_BUFFER_SIZE must be a power of 2 greater than 1."
95 96
   #endif
96
-
97
-  struct ring_buffer_r {
98
-    unsigned char buffer[RX_BUFFER_SIZE];
99
-    volatile uint8_t head;
100
-    volatile uint8_t tail;
101
-  };
102
-
103
-  #if TX_BUFFER_SIZE > 0
104
-    struct ring_buffer_t {
105
-      unsigned char buffer[TX_BUFFER_SIZE];
106
-      volatile uint8_t head;
107
-      volatile uint8_t tail;
108
-    };
97
+  #if TX_BUFFER_SIZE && (TX_BUFFER_SIZE < 2 || TX_BUFFER_SIZE > 256 || !IS_POWER_OF_2(TX_BUFFER_SIZE))
98
+    #error "TX_BUFFER_SIZE must be 0 or a power of 2 greater than 1."
109 99
   #endif
110 100
 
111
-  #if UART_PRESENT(SERIAL_PORT)
112
-    extern ring_buffer_r rx_buffer;
113
-    #if TX_BUFFER_SIZE > 0
114
-      extern ring_buffer_t tx_buffer;
115
-    #endif
101
+  #if RX_BUFFER_SIZE > 256
102
+    typedef uint16_t ring_buffer_pos_t;
103
+  #else
104
+    typedef uint8_t ring_buffer_pos_t;
105
+  #endif
106
+  
107
+  #if ENABLED(SERIAL_STATS_DROPPED_RX)
108
+    extern uint8_t rx_dropped_bytes;
116 109
   #endif
117 110
 
111
+  #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
112
+    extern ring_buffer_pos_t rx_max_enqueued;
113
+  #endif  
114
+  
118 115
   class MarlinSerial { //: public Stream
119 116
 
120 117
     public:
@@ -124,13 +121,22 @@
124 121
       static int peek(void);
125 122
       static int read(void);
126 123
       static void flush(void);
127
-      static uint8_t available(void);
124
+      static ring_buffer_pos_t available(void);
128 125
       static void checkRx(void);
129 126
       static void write(const uint8_t c);
130 127
       #if TX_BUFFER_SIZE > 0
131 128
         static uint8_t availableForWrite(void);
132 129
         static void flushTX(void);
133 130
       #endif
131
+      static void writeNoHandshake(const uint8_t c);
132
+
133
+      #if ENABLED(SERIAL_STATS_DROPPED_RX)
134
+        FORCE_INLINE static uint32_t dropped() { return rx_dropped_bytes; }
135
+      #endif
136
+
137
+      #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
138
+        FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return rx_max_enqueued; }
139
+      #endif  
134 140
 
135 141
     private:
136 142
       static void printNumber(unsigned long, const uint8_t);

+ 14
- 4
Marlin/Marlin_main.cpp 查看文件

@@ -1098,9 +1098,10 @@ inline void get_serial_commands() {
1098 1098
   /**
1099 1099
    * Loop while serial characters are incoming and the queue is not full
1100 1100
    */
1101
-  while (commands_in_queue < BUFSIZE && MYSERIAL.available() > 0) {
1101
+  int c;
1102
+  while (commands_in_queue < BUFSIZE && (c = MYSERIAL.read()) >= 0) {
1102 1103
 
1103
-    char serial_char = MYSERIAL.read();
1104
+    char serial_char = c;
1104 1105
 
1105 1106
     /**
1106 1107
      * If the character ends the line
@@ -1200,9 +1201,9 @@ inline void get_serial_commands() {
1200 1201
       // The command will be injected when EOL is reached
1201 1202
     }
1202 1203
     else if (serial_char == '\\') {  // Handle escapes
1203
-      if (MYSERIAL.available() > 0) {
1204
+      if ((c = MYSERIAL.read()) >= 0) {
1204 1205
         // if we have one more character, copy it over
1205
-        serial_char = MYSERIAL.read();
1206
+        serial_char = c;
1206 1207
         if (!serial_comment_mode) serial_line_buffer[serial_count++] = serial_char;
1207 1208
       }
1208 1209
       // otherwise do nothing
@@ -13610,6 +13611,15 @@ void loop() {
13610 13611
           // M29 closes the file
13611 13612
           card.closefile();
13612 13613
           SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED);
13614
+
13615
+          #if ENABLED(SERIAL_STATS_DROPPED_RX)
13616
+            SERIAL_ECHOLNPAIR("Dropped bytes: ", customizedSerial.dropped());
13617
+          #endif
13618
+
13619
+          #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
13620
+            SERIAL_ECHOLNPAIR("Max RX Queue Size: ", customizedSerial.rxMaxEnqueued());
13621
+          #endif
13622
+
13613 13623
           ok_to_send();
13614 13624
         }
13615 13625
         else {

+ 2
- 1
Marlin/example_configurations/AlephObjects/TAZ4/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 22
- 0
Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/AliExpress/CL-260/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 2
- 1
Marlin/example_configurations/Anet/A6/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 115200
114 115
 

+ 22
- 0
Marlin/example_configurations/Anet/A6/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/Anet/A8/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 115200
114 115
 

+ 22
- 0
Marlin/example_configurations/Anet/A8/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/BQ/Hephestos/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 115200
114 115
 

+ 22
- 0
Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/BQ/Hephestos_2/Configuration.h 查看文件

@@ -106,8 +106,9 @@
106 106
  *
107 107
  * 250000 works in most cases, but you might try a lower speed if
108 108
  * you commonly experience drop-outs during host printing.
109
+ * You may try up to 1000000 to speed up SD file transfer.
109 110
  *
110
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
111
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
111 112
  */
112 113
 #define BAUDRATE 115200
113 114
 

+ 22
- 0
Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 32
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/BQ/WITBOX/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 115200
114 115
 

+ 22
- 0
Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/Cartesio/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 115200
114 115
 

+ 22
- 0
Marlin/example_configurations/Cartesio/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/Creality/CR-10/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 115200
114 115
 

+ 2
- 1
Marlin/example_configurations/Felix/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 22
- 0
Marlin/example_configurations/Felix/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/Felix/DUAL/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 2
- 1
Marlin/example_configurations/Folger Tech/i3-2020/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 22
- 0
Marlin/example_configurations/Folger Tech/i3-2020/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/Geeetech/GT2560/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 2
- 1
Marlin/example_configurations/Geeetech/I3_Pro_X-GT2560/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 2
- 1
Marlin/example_configurations/Infitary/i3-M508/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 22
- 0
Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/Malyan/M150/Configuration.h 查看文件

@@ -112,8 +112,9 @@
112 112
  *
113 113
  * 250000 works in most cases, but you might try a lower speed if
114 114
  * you commonly experience drop-outs during host printing.
115
+ * You may try up to 1000000 to speed up SD file transfer.
115 116
  *
116
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
117
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
117 118
  */
118 119
 #define BAUDRATE 115200
119 120
 

+ 22
- 0
Marlin/example_configurations/Malyan/M150/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 2
- 1
Marlin/example_configurations/RigidBot/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 115200
114 115
 

+ 22
- 0
Marlin/example_configurations/RigidBot/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/SCARA/Configuration.h 查看文件

@@ -137,8 +137,9 @@
137 137
  *
138 138
  * 250000 works in most cases, but you might try a lower speed if
139 139
  * you commonly experience drop-outs during host printing.
140
+ * You may try up to 1000000 to speed up SD file transfer.
140 141
  *
141
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
142
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
142 143
  */
143 144
 #define BAUDRATE 250000
144 145
 

+ 22
- 0
Marlin/example_configurations/SCARA/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/TinyBoy2/Configuration.h 查看文件

@@ -123,8 +123,9 @@
123 123
  *
124 124
  * 250000 works in most cases, but you might try a lower speed if
125 125
  * you commonly experience drop-outs during host printing.
126
+ * You may try up to 1000000 to speed up SD file transfer.
126 127
  *
127
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
128
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
128 129
  */
129 130
 #define BAUDRATE 115200
130 131
 

+ 22
- 0
Marlin/example_configurations/TinyBoy2/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 64
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/Velleman/K8200/Configuration.h 查看文件

@@ -123,8 +123,9 @@
123 123
  *
124 124
  * 250000 works in most cases, but you might try a lower speed if
125 125
  * you commonly experience drop-outs during host printing.
126
+ * You may try up to 1000000 to speed up SD file transfer.
126 127
  *
127
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
128
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
128 129
  */
129 130
 #define BAUDRATE 250000
130 131
 

+ 22
- 0
Marlin/example_configurations/Velleman/K8200/Configuration_adv.h 查看文件

@@ -766,6 +766,28 @@
766 766
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
767 767
 #define TX_BUFFER_SIZE 128
768 768
 
769
+// Host Receive Buffer Size
770
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
771
+// To use flow control, set this buffer size to at least 1024 bytes.
772
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
773
+//#define RX_BUFFER_SIZE 1024
774
+
775
+#if RX_BUFFER_SIZE >= 1024
776
+  // Enable to have the controller send XON/XOFF control characters to
777
+  // the host to signal the RX buffer is becoming full.
778
+  //#define SERIAL_XON_XOFF
779
+#endif
780
+
781
+#if ENABLED(SDSUPPORT)
782
+  // Enable this option to collect and display the maximum
783
+  // RX queue usage after transferring a file to SD.
784
+  //#define SERIAL_STATS_MAX_RX_QUEUED
785
+
786
+  // Enable this option to collect and display the number
787
+  // of dropped bytes after a file transfer to SD.
788
+  //#define SERIAL_STATS_DROPPED_RX
789
+#endif
790
+
769 791
 // Enable an emergency-command parser to intercept certain commands as they
770 792
 // enter the serial receive buffer, so they cannot be blocked.
771 793
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/Velleman/K8400/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 22
- 0
Marlin/example_configurations/Velleman/K8400/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/Velleman/K8400/Dual-head/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 2
- 1
Marlin/example_configurations/adafruit/ST7565/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 2
- 1
Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 22
- 0
Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h 查看文件

@@ -755,6 +755,28 @@
755 755
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
756 756
 #define TX_BUFFER_SIZE 0
757 757
 
758
+// Host Receive Buffer Size
759
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
760
+// To use flow control, set this buffer size to at least 1024 bytes.
761
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
762
+//#define RX_BUFFER_SIZE 1024
763
+
764
+#if RX_BUFFER_SIZE >= 1024
765
+  // Enable to have the controller send XON/XOFF control characters to
766
+  // the host to signal the RX buffer is becoming full.
767
+  //#define SERIAL_XON_XOFF
768
+#endif
769
+
770
+#if ENABLED(SDSUPPORT)
771
+  // Enable this option to collect and display the maximum
772
+  // RX queue usage after transferring a file to SD.
773
+  //#define SERIAL_STATS_MAX_RX_QUEUED
774
+
775
+  // Enable this option to collect and display the number
776
+  // of dropped bytes after a file transfer to SD.
777
+  //#define SERIAL_STATS_DROPPED_RX
778
+#endif
779
+
758 780
 // Enable an emergency-command parser to intercept certain commands as they
759 781
 // enter the serial receive buffer, so they cannot be blocked.
760 782
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 22
- 0
Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h 查看文件

@@ -755,6 +755,28 @@
755 755
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
756 756
 #define TX_BUFFER_SIZE 0
757 757
 
758
+// Host Receive Buffer Size
759
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
760
+// To use flow control, set this buffer size to at least 1024 bytes.
761
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
762
+//#define RX_BUFFER_SIZE 1024
763
+
764
+#if RX_BUFFER_SIZE >= 1024
765
+  // Enable to have the controller send XON/XOFF control characters to
766
+  // the host to signal the RX buffer is becoming full.
767
+  //#define SERIAL_XON_XOFF
768
+#endif
769
+
770
+#if ENABLED(SDSUPPORT)
771
+  // Enable this option to collect and display the maximum
772
+  // RX queue usage after transferring a file to SD.
773
+  //#define SERIAL_STATS_MAX_RX_QUEUED
774
+
775
+  // Enable this option to collect and display the number
776
+  // of dropped bytes after a file transfer to SD.
777
+  //#define SERIAL_STATS_DROPPED_RX
778
+#endif
779
+
758 780
 // Enable an emergency-command parser to intercept certain commands as they
759 781
 // enter the serial receive buffer, so they cannot be blocked.
760 782
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/delta/generic/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 22
- 0
Marlin/example_configurations/delta/generic/Configuration_adv.h 查看文件

@@ -755,6 +755,28 @@
755 755
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
756 756
 #define TX_BUFFER_SIZE 0
757 757
 
758
+// Host Receive Buffer Size
759
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
760
+// To use flow control, set this buffer size to at least 1024 bytes.
761
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
762
+//#define RX_BUFFER_SIZE 1024
763
+
764
+#if RX_BUFFER_SIZE >= 1024
765
+  // Enable to have the controller send XON/XOFF control characters to
766
+  // the host to signal the RX buffer is becoming full.
767
+  //#define SERIAL_XON_XOFF
768
+#endif
769
+
770
+#if ENABLED(SDSUPPORT)
771
+  // Enable this option to collect and display the maximum
772
+  // RX queue usage after transferring a file to SD.
773
+  //#define SERIAL_STATS_MAX_RX_QUEUED
774
+
775
+  // Enable this option to collect and display the number
776
+  // of dropped bytes after a file transfer to SD.
777
+  //#define SERIAL_STATS_DROPPED_RX
778
+#endif
779
+
758 780
 // Enable an emergency-command parser to intercept certain commands as they
759 781
 // enter the serial receive buffer, so they cannot be blocked.
760 782
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/delta/kossel_mini/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 22
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h 查看文件

@@ -755,6 +755,28 @@
755 755
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
756 756
 #define TX_BUFFER_SIZE 0
757 757
 
758
+// Host Receive Buffer Size
759
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
760
+// To use flow control, set this buffer size to at least 1024 bytes.
761
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
762
+//#define RX_BUFFER_SIZE 1024
763
+
764
+#if RX_BUFFER_SIZE >= 1024
765
+  // Enable to have the controller send XON/XOFF control characters to
766
+  // the host to signal the RX buffer is becoming full.
767
+  //#define SERIAL_XON_XOFF
768
+#endif
769
+
770
+#if ENABLED(SDSUPPORT)
771
+  // Enable this option to collect and display the maximum
772
+  // RX queue usage after transferring a file to SD.
773
+  //#define SERIAL_STATS_MAX_RX_QUEUED
774
+
775
+  // Enable this option to collect and display the number
776
+  // of dropped bytes after a file transfer to SD.
777
+  //#define SERIAL_STATS_DROPPED_RX
778
+#endif
779
+
758 780
 // Enable an emergency-command parser to intercept certain commands as they
759 781
 // enter the serial receive buffer, so they cannot be blocked.
760 782
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/delta/kossel_pro/Configuration.h 查看文件

@@ -111,8 +111,9 @@
111 111
  *
112 112
  * 250000 works in most cases, but you might try a lower speed if
113 113
  * you commonly experience drop-outs during host printing.
114
+ * You may try up to 1000000 to speed up SD file transfer.
114 115
  *
115
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
116
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
116 117
  */
117 118
 #define BAUDRATE 115200
118 119
 

+ 22
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h 查看文件

@@ -760,6 +760,28 @@
760 760
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
761 761
 #define TX_BUFFER_SIZE 0
762 762
 
763
+// Host Receive Buffer Size
764
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
765
+// To use flow control, set this buffer size to at least 1024 bytes.
766
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
767
+//#define RX_BUFFER_SIZE 1024
768
+
769
+#if RX_BUFFER_SIZE >= 1024
770
+  // Enable to have the controller send XON/XOFF control characters to
771
+  // the host to signal the RX buffer is becoming full.
772
+  //#define SERIAL_XON_XOFF
773
+#endif
774
+
775
+#if ENABLED(SDSUPPORT)
776
+  // Enable this option to collect and display the maximum
777
+  // RX queue usage after transferring a file to SD.
778
+  //#define SERIAL_STATS_MAX_RX_QUEUED
779
+
780
+  // Enable this option to collect and display the number
781
+  // of dropped bytes after a file transfer to SD.
782
+  //#define SERIAL_STATS_DROPPED_RX
783
+#endif
784
+
763 785
 // Enable an emergency-command parser to intercept certain commands as they
764 786
 // enter the serial receive buffer, so they cannot be blocked.
765 787
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/delta/kossel_xl/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 22
- 0
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h 查看文件

@@ -755,6 +755,28 @@
755 755
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
756 756
 #define TX_BUFFER_SIZE 0
757 757
 
758
+// Host Receive Buffer Size
759
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
760
+// To use flow control, set this buffer size to at least 1024 bytes.
761
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
762
+//#define RX_BUFFER_SIZE 1024
763
+
764
+#if RX_BUFFER_SIZE >= 1024
765
+  // Enable to have the controller send XON/XOFF control characters to
766
+  // the host to signal the RX buffer is becoming full.
767
+  //#define SERIAL_XON_XOFF
768
+#endif
769
+
770
+#if ENABLED(SDSUPPORT)
771
+  // Enable this option to collect and display the maximum
772
+  // RX queue usage after transferring a file to SD.
773
+  //#define SERIAL_STATS_MAX_RX_QUEUED
774
+
775
+  // Enable this option to collect and display the number
776
+  // of dropped bytes after a file transfer to SD.
777
+  //#define SERIAL_STATS_DROPPED_RX
778
+#endif
779
+
758 780
 // Enable an emergency-command parser to intercept certain commands as they
759 781
 // enter the serial receive buffer, so they cannot be blocked.
760 782
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/gCreate/gMax1.5+/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 22
- 0
Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 32
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/makibox/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 22
- 0
Marlin/example_configurations/makibox/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/tvrrug/Round2/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 250000
114 115
 

+ 22
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 2
- 1
Marlin/example_configurations/wt150/Configuration.h 查看文件

@@ -107,8 +107,9 @@
107 107
  *
108 108
  * 250000 works in most cases, but you might try a lower speed if
109 109
  * you commonly experience drop-outs during host printing.
110
+ * You may try up to 1000000 to speed up SD file transfer.
110 111
  *
111
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000]
112
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
112 113
  */
113 114
 #define BAUDRATE 115200
114 115
 

+ 22
- 0
Marlin/example_configurations/wt150/Configuration_adv.h 查看文件

@@ -753,6 +753,28 @@
753 753
 // :[0, 2, 4, 8, 16, 32, 64, 128, 256]
754 754
 #define TX_BUFFER_SIZE 0
755 755
 
756
+// Host Receive Buffer Size
757
+// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
758
+// To use flow control, set this buffer size to at least 1024 bytes.
759
+// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
760
+//#define RX_BUFFER_SIZE 1024
761
+
762
+#if RX_BUFFER_SIZE >= 1024
763
+  // Enable to have the controller send XON/XOFF control characters to
764
+  // the host to signal the RX buffer is becoming full.
765
+  //#define SERIAL_XON_XOFF
766
+#endif
767
+
768
+#if ENABLED(SDSUPPORT)
769
+  // Enable this option to collect and display the maximum
770
+  // RX queue usage after transferring a file to SD.
771
+  //#define SERIAL_STATS_MAX_RX_QUEUED
772
+
773
+  // Enable this option to collect and display the number
774
+  // of dropped bytes after a file transfer to SD.
775
+  //#define SERIAL_STATS_DROPPED_RX
776
+#endif
777
+
756 778
 // Enable an emergency-command parser to intercept certain commands as they
757 779
 // enter the serial receive buffer, so they cannot be blocked.
758 780
 // Currently handles M108, M112, M410

+ 3
- 0
Marlin/macros.h 查看文件

@@ -99,6 +99,9 @@
99 99
 #define CBI(n,b) (n &= ~_BV(b))
100 100
 #define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (_BV(b))
101 101
 
102
+// Macro to check that a number if a power if 2
103
+#define IS_POWER_OF_2(x) ((x) && !((x) & ((x) - 1)))
104
+
102 105
 // Macros for maths shortcuts
103 106
 #ifndef M_PI
104 107
   #define M_PI 3.14159265358979323846

Loading…
取消
儲存