Browse Source

[1.1.x] SERIAL_XON_XOFF not supported on USB-native AVR devices (#8653)

* SERIAL_XON_XOFF not supported on USB-native AVR devices

User could enable SERIAL_XON_XOFF on USB-native devices and it would not be enabled without warning, but M115 would report the capability as available.
Dave Johnson 7 years ago
parent
commit
860d98a897
2 changed files with 21 additions and 15 deletions
  1. 14
    15
      Marlin/MarlinSerial.h
  2. 7
    0
      Marlin/SanityCheck.h

+ 14
- 15
Marlin/MarlinSerial.h View File

75
 #define BIN 2
75
 #define BIN 2
76
 #define BYTE 0
76
 #define BYTE 0
77
 
77
 
78
-#ifndef USBCON
79
-  // Define constants and variables for buffering incoming serial data.  We're
80
-  // using a ring buffer (I think), in which rx_buffer_head is the index of the
81
-  // location to which to write the next incoming character and rx_buffer_tail
82
-  // is the index of the location from which to read.
83
-  // Use only powers of 2.
84
-  // : [0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...]
85
-  #ifndef RX_BUFFER_SIZE
86
-    #define RX_BUFFER_SIZE 128
87
-  #endif
88
-  // 256 is the max TX buffer climit due to uint8_t head and tail.
89
-  #ifndef TX_BUFFER_SIZE
90
-    #define TX_BUFFER_SIZE 32
91
-  #endif
78
+// Define constants and variables for buffering serial data.
79
+// Use only 0 or powers of 2 greater than 1
80
+// : [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...]
81
+#ifndef RX_BUFFER_SIZE
82
+  #define RX_BUFFER_SIZE 128
83
+#endif
84
+// 256 is the max TX buffer limit due to uint8_t head and tail.
85
+#ifndef TX_BUFFER_SIZE
86
+  #define TX_BUFFER_SIZE 32
87
+#endif
92
 
88
 
89
+#ifndef USBCON
93
   #if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
90
   #if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
94
-    #error "XON/XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
91
+    #error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
95
   #endif
92
   #endif
93
+
96
   #if !IS_POWER_OF_2(RX_BUFFER_SIZE) || RX_BUFFER_SIZE < 2
94
   #if !IS_POWER_OF_2(RX_BUFFER_SIZE) || RX_BUFFER_SIZE < 2
97
     #error "RX_BUFFER_SIZE must be a power of 2 greater than 1."
95
     #error "RX_BUFFER_SIZE must be a power of 2 greater than 1."
98
   #endif
96
   #endif
97
+
99
   #if TX_BUFFER_SIZE && (TX_BUFFER_SIZE < 2 || TX_BUFFER_SIZE > 256 || !IS_POWER_OF_2(TX_BUFFER_SIZE))
98
   #if TX_BUFFER_SIZE && (TX_BUFFER_SIZE < 2 || TX_BUFFER_SIZE > 256 || !IS_POWER_OF_2(TX_BUFFER_SIZE))
100
     #error "TX_BUFFER_SIZE must be 0, a power of 2 greater than 1, and no greater than 256."
99
     #error "TX_BUFFER_SIZE must be 0, a power of 2 greater than 1, and no greater than 256."
101
   #endif
100
   #endif

+ 7
- 0
Marlin/SanityCheck.h View File

246
 #endif
246
 #endif
247
 
247
 
248
 /**
248
 /**
249
+ * Serial
250
+ */
251
+#if defined(USBCON) && ENABLED(SERIAL_XON_XOFF)
252
+  #error "SERIAL_XON_XOFF is not supported on USB-native AVR devices."
253
+#endif
254
+
255
+/**
249
  * Dual Stepper Drivers
256
  * Dual Stepper Drivers
250
  */
257
  */
251
 #if ENABLED(X_DUAL_STEPPER_DRIVERS) && ENABLED(DUAL_X_CARRIAGE)
258
 #if ENABLED(X_DUAL_STEPPER_DRIVERS) && ENABLED(DUAL_X_CARRIAGE)

Loading…
Cancel
Save