From ff7004fcc5b42ddd4fc9e1b0fa5847a92bf62272 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 28 Dec 2013 14:24:06 +1100 Subject: [PATCH] HAL_PX4: use larger buffers on USB --- libraries/AP_HAL_PX4/UARTDriver.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libraries/AP_HAL_PX4/UARTDriver.cpp b/libraries/AP_HAL_PX4/UARTDriver.cpp index 647971e815..7a8e817dc8 100644 --- a/libraries/AP_HAL_PX4/UARTDriver.cpp +++ b/libraries/AP_HAL_PX4/UARTDriver.cpp @@ -44,14 +44,21 @@ void PX4UARTDriver::begin(uint32_t b, uint16_t rxS, uint16_t txS) // leave uninitialised return; } + + uint16_t min_tx_buffer = 512; + uint16_t min_rx_buffer = 512; + if (strcmp(_devpath, "/dev/ttyACM0") == 0) { + min_tx_buffer = 4096; + min_rx_buffer = 1024; + } // on PX4 we have enough memory to have a larger transmit and // receive buffer for all ports. This means we don't get delays // while waiting to write GPS config packets - if (txS < 512) { - txS = 512; + if (txS < min_tx_buffer) { + txS = min_tx_buffer; } - if (rxS < 512) { - rxS = 512; + if (rxS < min_rx_buffer) { + rxS = min_rx_buffer; } /*