From 4c5ffd23499d6baf65c6718d6ca2b3a1d28542af Mon Sep 17 00:00:00 2001
From: Unknown <davejohnson3000@gmail.com>
Date: Sat, 2 Dec 2017 21:07:21 -0800
Subject: [PATCH] [2.0.x] Report SERIAL_XON_XOFF in M115

-Report SERIAL_XON_XOFF in Extended Capabilites M115 report for hosts
-Remove outdated 256 size limitation from comments on RX_BUFFER_SIZE defines
-Update error message conditions
---
 Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h | 2 +-
 Marlin/src/gcode/host/M115.cpp            | 7 +++++++
 Marlin/src/inc/Conditionals_adv.h         | 4 +++-
 Marlin/src/inc/SanityCheck.h              | 2 +-
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h
index 740db4d9c5..e80fc99e14 100644
--- a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h
+++ b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h
@@ -64,7 +64,7 @@
 #endif
 
 #if TX_BUFFER_SIZE && (TX_BUFFER_SIZE < 2 || TX_BUFFER_SIZE > 256 || !IS_POWER_OF_2(TX_BUFFER_SIZE))
-  #error "TX_BUFFER_SIZE must be 0 or a power of 2 greater than 1."
+  #error "TX_BUFFER_SIZE must be 0, a power of 2 greater than 1, and no greater than 256."
 #endif
 
 #if RX_BUFFER_SIZE > 256
diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp
index 99b4a81593..e20666845f 100644
--- a/Marlin/src/gcode/host/M115.cpp
+++ b/Marlin/src/gcode/host/M115.cpp
@@ -31,6 +31,13 @@ void GcodeSuite::M115() {
 
   #if ENABLED(EXTENDED_CAPABILITIES_REPORT)
 
+    // SERIAL_XON_XOFF
+    #if ENABLED(SERIAL_XON_XOFF)
+      SERIAL_PROTOCOLLNPGM("Cap:SERIAL_XON_XOFF:1");
+    #else
+      SERIAL_PROTOCOLLNPGM("Cap:SERIAL_XON_XOFF:0");
+    #endif
+
     // EEPROM (M500, M501)
     #if ENABLED(EEPROM_SETTINGS)
       SERIAL_PROTOCOLLNPGM("Cap:EEPROM:1");
diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h
index df480d59b9..e31b2b7842 100644
--- a/Marlin/src/inc/Conditionals_adv.h
+++ b/Marlin/src/inc/Conditionals_adv.h
@@ -30,10 +30,12 @@
 
   #ifndef USBCON
     // Define constants and variables for buffering incoming serial data.
-    // 256 is the max limit due to uint8_t head and tail. Use only powers of 2. (...,16,32,64,128,256)
+    // Use only powers of 2.
+    // : [0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...]
     #ifndef RX_BUFFER_SIZE
       #define RX_BUFFER_SIZE 128
     #endif
+    // 256 is the max TX buffer climit due to uint8_t head and tail.
     #ifndef TX_BUFFER_SIZE
       #define TX_BUFFER_SIZE 32
     #endif
diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h
index c093e0fc62..b4bafe2cdf 100644
--- a/Marlin/src/inc/SanityCheck.h
+++ b/Marlin/src/inc/SanityCheck.h
@@ -262,7 +262,7 @@
 
   // 256 is the max limit due to uint8_t head and tail. Use only powers of 2. (...,16,32,64,128,256)
   #if TX_BUFFER_SIZE && (TX_BUFFER_SIZE < 2 || TX_BUFFER_SIZE > 256 || !IS_POWER_OF_2(TX_BUFFER_SIZE))
-    #error "TX_BUFFER_SIZE must be 0 or a power of 2 greater than 1."
+    #error "TX_BUFFER_SIZE must be 0, a power of 2 greater than 1, and no greater than 256."
   #endif
 #endif