From f0ea7c2c440aa69391ab41e097755b35c26ac6fd Mon Sep 17 00:00:00 2001 From: Stefan de Bruijn Date: Wed, 7 Oct 2020 04:12:28 +0200 Subject: [PATCH] Changed buffer sizes to 256 throughout various parts of the program. (#626) This is a patch necessary for F360 personal users, because they decided to add a very lengthy comment... Co-authored-by: Stefan de Bruijn --- Grbl_Esp32/src/Protocol.h | 2 +- Grbl_Esp32/src/Serial.cpp | 4 +++- Grbl_Esp32/src/Serial.h | 2 +- Grbl_Esp32/src/WebUI/InputBuffer.h | 2 +- Grbl_Esp32/src/WebUI/Serial2Socket.h | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Grbl_Esp32/src/Protocol.h b/Grbl_Esp32/src/Protocol.h index 6b91553d..83033064 100644 --- a/Grbl_Esp32/src/Protocol.h +++ b/Grbl_Esp32/src/Protocol.h @@ -31,7 +31,7 @@ // memory space we can invest into here or we re-write the g-code parser not to have this // buffer. #ifndef LINE_BUFFER_SIZE -# define LINE_BUFFER_SIZE 80 +# define LINE_BUFFER_SIZE 256 #endif // Starts Grbl main loop. It handles all incoming characters from the serial port and executes diff --git a/Grbl_Esp32/src/Serial.cpp b/Grbl_Esp32/src/Serial.cpp index e79516c3..ae559c4b 100644 --- a/Grbl_Esp32/src/Serial.cpp +++ b/Grbl_Esp32/src/Serial.cpp @@ -70,6 +70,7 @@ uint8_t serial_get_rx_buffer_available(uint8_t client) { void serial_init() { Serial.begin(BAUD_RATE); + Serial.setRxBufferSize(256); // reset all buffers serial_reset_read_buffer(CLIENT_ALL); grbl_send(CLIENT_SERIAL, "\r\n"); // create some white space after ESP32 boot info @@ -104,7 +105,8 @@ void serialCheckTask(void* pvParameters) { if (WebUI::SerialBT.hasClient() && WebUI::SerialBT.available()) { client = CLIENT_BT; data = WebUI::SerialBT.read(); - //Serial.write(data); // echo all data to serial + + // Serial.write(data); // echo all data to serial. } else { #endif #if defined(ENABLE_WIFI) && defined(ENABLE_HTTP) && defined(ENABLE_SERIAL2SOCKET_IN) diff --git a/Grbl_Esp32/src/Serial.h b/Grbl_Esp32/src/Serial.h index 598c6431..8d3f4b93 100644 --- a/Grbl_Esp32/src/Serial.h +++ b/Grbl_Esp32/src/Serial.h @@ -23,7 +23,7 @@ #include "Grbl.h" #ifndef RX_BUFFER_SIZE -# define RX_BUFFER_SIZE 128 +# define RX_BUFFER_SIZE 256 #endif #ifndef TX_BUFFER_SIZE # ifdef USE_LINE_NUMBERS diff --git a/Grbl_Esp32/src/WebUI/InputBuffer.h b/Grbl_Esp32/src/WebUI/InputBuffer.h index 4eec0ca6..da25b6c5 100644 --- a/Grbl_Esp32/src/WebUI/InputBuffer.h +++ b/Grbl_Esp32/src/WebUI/InputBuffer.h @@ -49,7 +49,7 @@ namespace WebUI { ~InputBuffer(); private: - static const int RXBUFFERSIZE = 128; + static const int RXBUFFERSIZE = 256; uint8_t _RXbuffer[RXBUFFERSIZE]; uint16_t _RXbufferSize; diff --git a/Grbl_Esp32/src/WebUI/Serial2Socket.h b/Grbl_Esp32/src/WebUI/Serial2Socket.h index 7d337520..9babdf95 100644 --- a/Grbl_Esp32/src/WebUI/Serial2Socket.h +++ b/Grbl_Esp32/src/WebUI/Serial2Socket.h @@ -28,7 +28,7 @@ class WebSocketsServer; namespace WebUI { class Serial_2_Socket : public Print { static const int TXBUFFERSIZE = 1200; - static const int RXBUFFERSIZE = 128; + static const int RXBUFFERSIZE = 256; static const int FLUSHTIMEOUT = 500; public: